mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
`:fenced_code_blocks:` Blocks delimited with 3 or more ~ or backticks will be considered as code, without the need to be indented. An optional language name may be added at the end of the opening fence for the code block. `:disable_indented_code_blocks:` Do not parse usual markdown code blocks. Markdown converts text with four spaces at the front of each line to code blocks. This option prevents it from doing so. Recommended to use with fenced_code_blocks: true. Fixes #2764
20 lines
609 B
Ruby
20 lines
609 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
describe FormatHelper, type: :helper do
|
|
|
|
describe 'markdown' do
|
|
it 'should return empty string for nil' do
|
|
expect(markdown(nil)).to eq ''
|
|
end
|
|
|
|
it 'should return HTML for header markdown' do
|
|
expect(Redcarpet::Markdown).to receive(:new)
|
|
.with(Redcarpet::Render::HTML, autolink: true, space_after_headers: true, no_intra_emphasis: true, fenced_code_blocks: true, disable_indented_code_blocks: true)
|
|
.and_call_original
|
|
|
|
expect(markdown('# this is my header')).to eq "<h1>this is my header</h1>\n"
|
|
end
|
|
end
|
|
end
|