Commit 806695f491a8853a66d6dbde58b9e9d3eee1a72a
1 parent
58a58178
Exists in
master
and in
4 other branches
Split and reformat markdown options and add refs to their docs.
Also add hard_wrap option.
Showing
1 changed file
with
18 additions
and
11 deletions
Show diff stats
app/helpers/gitlab_markdown_helper.rb
@@ -54,17 +54,24 @@ module GitlabMarkdownHelper | @@ -54,17 +54,24 @@ module GitlabMarkdownHelper | ||
54 | end | 54 | end |
55 | 55 | ||
56 | def markdown(text) | 56 | def markdown(text) |
57 | - @__renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::GitlabHTML.new(self, filter_html: true, with_toc_data: true), { | ||
58 | - no_intra_emphasis: true, | ||
59 | - tables: true, | ||
60 | - fenced_code_blocks: true, | ||
61 | - autolink: true, | ||
62 | - strikethrough: true, | ||
63 | - lax_html_blocks: true, | ||
64 | - space_after_headers: true, | ||
65 | - superscript: true | ||
66 | - }) | 57 | + unless @markdown |
58 | + gitlab_renderer = Redcarpet::Render::GitlabHTML.new(self, | ||
59 | + # see https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderers-for-lunch- | ||
60 | + filter_html: true, | ||
61 | + with_toc_data: true, | ||
62 | + hard_wrap: true) | ||
63 | + @markdown ||= Redcarpet::Markdown.new(gitlab_renderer, | ||
64 | + # see https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use | ||
65 | + no_intra_emphasis: true, | ||
66 | + tables: true, | ||
67 | + fenced_code_blocks: true, | ||
68 | + autolink: true, | ||
69 | + strikethrough: true, | ||
70 | + lax_html_blocks: true, | ||
71 | + space_after_headers: true, | ||
72 | + superscript: true) | ||
73 | + end | ||
67 | 74 | ||
68 | - @__renderer.render(text).html_safe | 75 | + @markdown.render(text).html_safe |
69 | end | 76 | end |
70 | end | 77 | end |