Skip to content

Commit

Permalink
Merge pull request #1096 from skipkayhil/hm-rich-label-list-labels-md
Browse files Browse the repository at this point in the history
Allow rich definition list labels for Markdown
  • Loading branch information
nobu committed Mar 11, 2024
2 parents aa2d98e + 8f943bb commit 5541692
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rdoc/markdown.kpeg
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ DefinitionListItem = ( DefinitionListLabel+ ):label
list_items
}

DefinitionListLabel = StrChunk:label @Sp @Newline
DefinitionListLabel = Inline:label @Sp @Newline
{ label }

DefinitionListDefinition = @NonindentSpace ":" @Space Inlines:a @BlankLine+
Expand Down
19 changes: 19 additions & 0 deletions test/rdoc/test_rdoc_markdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,25 @@ def test_parse_definition_list_multi_line
assert_equal expected, doc
end

def test_parse_definition_list_rich_label
doc = parse <<-MD
`one`
: This is a definition
**two**
: This is another definition
MD

expected = doc(
list(:NOTE,
item(%w[<code>one</code>],
para("This is a definition")),
item(%w[*two*],
para("This is another definition"))))

assert_equal expected, doc
end

def test_parse_definition_list_no
@parser.definition_lists = false

Expand Down

0 comments on commit 5541692

Please sign in to comment.