Render Kramdown through Gitlab Markup

In this commit we change the way Kramdown format is rendered.

Instead of using `GitHub::Markup` we're going to use `GitLab::Markup`,
avoiding rendering some extensions Kramdown has.
parent 8cbd3ebd
---
title: Render Kramdown format using Gitlab markup
merge_request: 56750
author:
type: changed
...@@ -4,7 +4,7 @@ module Gitlab ...@@ -4,7 +4,7 @@ module Gitlab
module MarkupHelper module MarkupHelper
extend self extend self
MARKDOWN_EXTENSIONS = %w[mdown mkd mkdn md markdown].freeze MARKDOWN_EXTENSIONS = %w[mdown mkd mkdn md markdown rmd].freeze
ASCIIDOC_EXTENSIONS = %w[adoc ad asciidoc].freeze ASCIIDOC_EXTENSIONS = %w[adoc ad asciidoc].freeze
OTHER_EXTENSIONS = %w[textile rdoc org creole wiki mediawiki rst].freeze OTHER_EXTENSIONS = %w[textile rdoc org creole wiki mediawiki rst].freeze
EXTENSIONS = MARKDOWN_EXTENSIONS + ASCIIDOC_EXTENSIONS + OTHER_EXTENSIONS EXTENSIONS = MARKDOWN_EXTENSIONS + ASCIIDOC_EXTENSIONS + OTHER_EXTENSIONS
......
...@@ -382,6 +382,27 @@ RSpec.describe MarkupHelper do ...@@ -382,6 +382,27 @@ RSpec.describe MarkupHelper do
end end
end end
context 'when file is Kramdown' do
let(:extension) { 'rmd' }
let(:content) do
<<-EOF
{::options parse_block_html="true" /}
<div>
FooBar
</div>
EOF
end
it 'renders using #markdown_unsafe helper method' do
expect(helper).to receive(:markdown_unsafe).with(content, context)
result = helper.render_wiki_content(wiki)
expect(result).to be_empty
end
end
context 'any other format' do context 'any other format' do
let(:extension) { 'foo' } let(:extension) { 'foo' }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment