-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Markdown parsing in doc comments for help messages Tracking Issue #5900
Comments
(I initially posted this in #5891 (comment) , but I think this is a better place) Thanks for a cool feature! I haven't looked at this PR carefully, but I'd appreciate an option to print hyperlink targets normally in addition to possible terminal hyperlinks, so that the user can copy-paste them normally. Even if the terminal understands hyperlinks, users might not expect a terminal to behave like a web browser. Also, some terminals make it hard to use hyperlinks in spite of supporting them. For example, in Ghostty 1.1.0 on a Mac, if mouse detection is on (the program inside the terminal requests mouse events, which for me is |
Currently you could achieve this by using the What would you like to see here additionally? |
One question is what parser to use for this. rustdoc compatibility is great but so is having good build times. I would say that my bare minimum requirement is that a subset of markdown can be parsed by rustdoc and clap. In #5891, @dpc mentioned the idea of using a djot parser. It was added to https://github.com/rosetta-rs/md-rosetta-rs. Not as fast to build as minimad but faster than pulldown-cmark. Release parse times are all in the same ballpark. Looking over their quick start, it mostly looks like a subset would work. The one question I had was about It would be good to evaluate minimad further to see if it has a subset of markdown that renders that same as rustdoc and how that compares to djot. |
If I write
I might want it to keep looking like that on output. I'd be quite happy for "frobnicate" to also become a terminal hyperlink, but I'd want to keep the last line in the output in the help text (if it goes to the terminal) for copy-pasting ease. I'd probably want the same for
OTOH, when the same text is used to generate HTML for a CLI Reference (which I currently do with https://github.com/ConnorGray/clap-markdown, which has some limitations), then of course I would want only a normal hyperlink. |
This tracks the feature
unstable-markdown
that implements compile time markdown parsing in the derive macros.Implemented Markdown features
# heading
![image]()
<html>
> blockquote
>
`code`
*emphasis*
**strong**
~stikethrough~
[link](url)
`inline code `
---
hrule---
surrounded by empty lines| tables |
\\\n
and\n
hard breakOpen Questions
•
for bullet lists,Options::ENABLE_SMART_PUNCTUATION
forpulldown_cmark
, unicode lines for blockquotesa.
,b.
andi.
,ii.
? we could use https://docs.rs/nominals for thatThe text was updated successfully, but these errors were encountered: