fix(markdown): render ordered lists with custom values and handle multiline list items
This commit is contained in:
parent
cf4048312e
commit
2daee794bc
3 changed files with 81 additions and 13 deletions
|
@ -10,7 +10,14 @@ module Redcarpet
|
|||
end
|
||||
|
||||
def list_item(content, list_type)
|
||||
content_tag(:li, content.strip.gsub(/<\/?p>/, ''), {}, false)
|
||||
item_number = content.match(/\[value:(\d+)\]/)
|
||||
text = content.strip
|
||||
.gsub(/<\/?p>/, '')
|
||||
.gsub(/\[value:\d+\]/, '')
|
||||
.gsub(/\n/, '<br>')
|
||||
attributes = item_number.present? ? { value: item_number[1] } : {}
|
||||
|
||||
content_tag(:li, text, attributes, false)
|
||||
end
|
||||
|
||||
def paragraph(text)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue