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]
|
||||
Kramdown::Document.new(spaces(desc), input: :html, line_width: line_width)
|
||||
.to_kramdown
|
||||
.gsub(/^#+ (.*)/, '### \1')
|
||||
.gsub(/\\([\"'])/, '\1') # Remove slash before quotes
|
||||
.remove(/[[:blank:]]+$/) # Remove extraneous spaces
|
||||
.remove(/{::}/) # Markdown artefact
|
||||
.gsub(/^#+ (.*)/, '**\1**')
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -19,8 +19,15 @@ class EventsHelperTest < ActionView::TestCase
|
|||
assert_equal '*ho* **h**,', to_markdown('<i>ho</i><b> h</b>,')
|
||||
end
|
||||
|
||||
test 'HTML titles to strong' do
|
||||
assert_equal '**Big**', to_markdown('<h1>Big</h1>,')
|
||||
assert_equal '**Big again**', to_markdown('<h2>Big again</h2>,')
|
||||
test 'HTML titles too strong' do
|
||||
assert_equal '### Big
|
||||
|
||||
', 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
|
||||
|
|
Loading…
Reference in New Issue