Titles (h1, h2) are changed to h3 for markdown digests
This commit is contained in:
parent
e3936359b9
commit
fa04fc1259
|
@ -65,10 +65,10 @@ module EventsHelper
|
||||||
attributes: %w[href]
|
attributes: %w[href]
|
||||||
Kramdown::Document.new(spaces(desc), input: :html, line_width: line_width)
|
Kramdown::Document.new(spaces(desc), input: :html, line_width: line_width)
|
||||||
.to_kramdown
|
.to_kramdown
|
||||||
|
.gsub(/^#+ (.*)/, '### \1')
|
||||||
.gsub(/\\([\"'])/, '\1') # Remove slash before quotes
|
.gsub(/\\([\"'])/, '\1') # Remove slash before quotes
|
||||||
.remove(/[[:blank:]]+$/) # Remove extraneous spaces
|
.remove(/[[:blank:]]+$/) # Remove extraneous spaces
|
||||||
.remove(/{::}/) # Markdown artefact
|
.remove(/{::}/) # Markdown artefact
|
||||||
.gsub(/^#+ (.*)/, '**\1**')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -19,8 +19,15 @@ class EventsHelperTest < ActionView::TestCase
|
||||||
assert_equal '*ho* **h**,', to_markdown('<i>ho</i><b> h</b>,')
|
assert_equal '*ho* **h**,', to_markdown('<i>ho</i><b> h</b>,')
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'HTML titles to strong' do
|
test 'HTML titles too strong' do
|
||||||
assert_equal '**Big**', to_markdown('<h1>Big</h1>,')
|
assert_equal '### Big
|
||||||
assert_equal '**Big again**', to_markdown('<h2>Big again</h2>,')
|
|
||||||
|
', to_markdown('<h1>Big</h1>')
|
||||||
|
assert_equal '### Big again
|
||||||
|
|
||||||
|
', to_markdown('<h2>Big again</h2>')
|
||||||
|
assert_equal '### **Too**
|
||||||
|
|
||||||
|
', to_markdown('<h3><strong>Too</strong></h3>')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue