diff options
| author | Hartley McGuire <skipkayhil@gmail.com> | 2024-03-06 20:22:28 -0500 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-03-11 20:00:51 +0900 |
| commit | 08961ce8e31487b31d19d4f66c6ef1aba5c7cd30 (patch) | |
| tree | d878824800f2cf8d46219b50d2a297f389ecfc1b /test/ruby | |
| parent | 7a398adc2f7c9a912c542d19169b73aed4a544d0 (diff) | |
[ruby/rdoc] Allow rich definition list labels for Markdown
Previously, any sort of "rich" markup for a definition list's label
would cause the Markdown parser to not recognize a definition list:
```ruby
md = <<~md
`one`
: This is a definition
md
doc = RDoc::Markdown.parse(md)
doc # => [doc: [para: "<code>one</code>\n: This is a definition"]]
```
This commit tweaks the grammar for Markdown definition lists so that
labels can include "rich" markup such as bold (`**`), code (```), etc:
```ruby
md = <<~md
`one`
: This is a definition
md
doc = RDoc::Markdown.parse(md)
doc # => [doc: [list: NOTE [item: ["<code>one</code>"]; [para: "This is a definition"]]]]
```
The [PHP Markdown Extra][1] Spec does not seem to specify whether or not
this should be allowed, but it is allowed in the RDoc format:
```ruby
rdoc = <<~rdoc
+code+::
This is a definition
rdoc
doc = RDoc::Markup.parse(rdoc)
doc # => [doc: [list: NOTE [item: ["+code+"]; [para: "This is a definition"]]]]
```
so accepting this change increases the parity of the two formats.
[1]: https://michelf.ca/projects/php-markdown/extra/#def-list
https://github.com/ruby/rdoc/commit/8f943bbba4
Diffstat (limited to 'test/ruby')
0 files changed, 0 insertions, 0 deletions
