yard icon indicating copy to clipboard operation
yard copied to clipboard

`--one-file` does not interpret Markdown by default

Open jacob-carlborg opened this issue 3 years ago • 3 comments

The --one-file flag does not interpret Markdown by default in the README.md file (I have not checked other non-source files).

Steps to reproduce

  1. Run the following commands:
cat << EOF >> foo.rb
# Foobar
# * asd
class Foo
end
EOF

cat << EOF >> README.md
# Foo
EOF

yard doc --one-file --no-save -o . foo.rb
  1. Open the generated index.html in the browser

Actual Output

The Markdown in the README.md has not been interpreted.

yard_no_md

Notice how # Foo is output from the README.md, but the Markdown in the foo.rb file has been interpreted and output as expected.

Expected Output

I expect the Markdown to be interpreted, this is what happens without the --one-file flag:

yard_md

Environment details:

  • OS: macOS 12.0.1
  • Ruby version (ruby -v): ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin20]
  • YARD version (yard -v): yard 0.9.27

jacob-carlborg avatar Jan 23 '22 08:01 jacob-carlborg

This is not an issue with --one-file or YARD. By default, YARD uses rdoc style markup in .rb files. If you wish to use Markdown as your markup format, you must specify it via -m markdown, see yard doc --help.

lsegal avatar Jan 24 '22 20:01 lsegal

I disagree. As you can see on the screenshots, the behavior is different with and without --one-file. I can post a screen recording that shows the whole flow.

jacob-carlborg avatar Jan 25 '22 09:01 jacob-carlborg

Here's a screen recording that shows how I generate the documentation both with and without the --one-file flag. I show both results in the browser side by side:

https://user-images.githubusercontent.com/306980/150955201-062274c5-c202-4571-8b2f-fe446ae973ee.mov

jacob-carlborg avatar Jan 25 '22 10:01 jacob-carlborg