mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 13:34:17 +02:00
![]() 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
|
||
---|---|---|
.. | ||
context | ||
generator | ||
i18n | ||
markdown | ||
markup | ||
parser | ||
rd | ||
ri | ||
stats | ||
.document | ||
alias.rb | ||
anon_class.rb | ||
any_method.rb | ||
attr.rb | ||
class_module.rb | ||
code_object.rb | ||
code_objects.rb | ||
comment.rb | ||
constant.rb | ||
context.rb | ||
cross_reference.rb | ||
encoding.rb | ||
erb_partial.rb | ||
erbio.rb | ||
extend.rb | ||
generator.rb | ||
ghost_method.rb | ||
i18n.rb | ||
include.rb | ||
known_classes.rb | ||
markdown.rb | ||
markup.rb | ||
meta_method.rb | ||
method_attr.rb | ||
mixin.rb | ||
normal_class.rb | ||
normal_module.rb | ||
options.rb | ||
parser.rb | ||
rd.rb | ||
rdoc.gemspec | ||
rdoc.rb | ||
require.rb | ||
ri.rb | ||
rubygems_hook.rb | ||
servlet.rb | ||
single_class.rb | ||
stats.rb | ||
store.rb | ||
task.rb | ||
text.rb | ||
token_stream.rb | ||
tom_doc.rb | ||
top_level.rb | ||
version.rb |