summaryrefslogtreecommitdiff
path: root/lib/rdoc/markup/to_markdown.rb
AgeCommit message (Collapse)Author
2025-01-15Migrate rdoc as bundled gemsHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12577
2024-03-08[ruby/rdoc] Fix ToMarkdown missing newlines for label-listsHartley McGuire
Previously, using ToMarkdown on a label-list would generate output that could not be reparsed by the RDoc::Markdown parser: ``` md = <<~MD apple : a red fruit banana : a yellow fruit MD doc = RDoc::Markdown.parse(md) doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit"]], [item: ["banana"]; [para: "a yellow fruit"]]]] new_md = doc.accept(RDoc::Markup::ToMarkdown.new) new_md # => "apple\n: a red fruit\nbanana\n: a yellow fruit\n\n" new_doc = RDoc::Markdown.parse(new_md) new_doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit\nbanana\n: a yellow fruit"]]]] ``` The issue is that the [PHP Markdown Extra spec][1] requires a newline after each definition list item, but ToMarkdown was not putting newlines between label-list items. This commit fixes the issue by properly appending a newline after each label-list item so that the output of ToMarkdown can be reparsed by RDoc::Markdown: ``` md = <<~MD apple : a red fruit banana : a yellow fruit MD doc = RDoc::Markdown.parse(mdoc) doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit"]], [item: ["banana"]; [para: "a yellow fruit"]]]] new_md = doc.accept(RDoc::Markup::ToMarkdown.new) new_md # => "apple\n: a red fruit\n\nbanana\n: a yellow fruit\n\n" new_doc = RDoc::Markdown.parse(new_md) new_doc # => [doc: [list: NOTE [item: ["apple"]; [para: "a red fruit"]], [item: ["banana"]; [para: "a yellow fruit"]]]] ``` [1]: https://michelf.ca/projects/php-markdown/extra/#def-list https://github.com/ruby/rdoc/commit/c65266437c
2023-06-03[ruby/rdoc] Auto-correct trailing new linesVinicius Stock
https://github.com/ruby/rdoc/commit/4b68c0728a
2018-11-26lib/rdoc/markup/: Remove wrong call to `=~` against Arraymame
`@res` is an Array, so `@res =~ /\n\z/` calls `Object#=~` which always returns nil. I guess it should be `@res.last =~ /\n\z/`, but the change causes test failures. This bug was found during work for removal of `Object#=~`. [Feature #15231] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-17Merge rdoc-6.1.0.beta2aycabta
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-27Merge rdoc-6.0.0.beta4 from upstream.hsbt
It version applied `frozen_string_literal: true` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-18* lib/rdoc: Update to RDoc 4.1.0.preview.1drbrain
RDoc 4.1.0 contains a number of enhancements including a new default style and accessibility support. You can see the changelog here: https://github.com/rdoc/rdoc/blob/v4.1.0.preview.1/History.rdoc * test/rdoc: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-16 * lib/rdoc.rb: Updated VERSION.drbrain
* lib/rdoc/markup/attribute_manager.rb: Removed useless empty check. * lib/rdoc/markup/to_markdown.rb: Support links from other formats. * lib/rdoc/markup/formatter.rb: ditto. * lib/rdoc/markup/to_html.rb: ditto. * test/rdoc/test_rdoc_markup_formatter.rb: Test for above. * test/rdoc/test_rdoc_markup_to_html.rb: ditto. * test/rdoc/test_rdoc_markup_to_markdown.rb: ditto. * lib/rdoc/rd/block_parser.rb: Improved footnote display. Worked around bug in footnote conversion to Markdown. * test/rdoc/test_rdoc_rd_block_parser.rb: Test for above. * lib/rdoc/rd/inline_parser.rb: Fixed bug with emphasis inside verbatim. * test/rdoc/test_rdoc_rd_inline_parser.rb: Test for above. * test/rdoc/test_rdoc_parser_rd.rb: Use mu_pp, use shortcut methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-27* lib/rdoc*: Updated to RDoc 4.0 (pre-release)drbrain
* bin/rdoc: ditto * test/rdoc: ditto * NEWS: Updated with RDoc 4.0 information git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e