Skip to content
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

rustdoc: Markdown headers don't get recognized in certain cases #33771

Closed
panicbit opened this issue May 21, 2016 · 13 comments
Closed

rustdoc: Markdown headers don't get recognized in certain cases #33771

panicbit opened this issue May 21, 2016 · 13 comments
Labels
C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@panicbit
Copy link
Contributor

panicbit commented May 21, 2016

#Headers don't seem to get recognized when the header is preceded by some text and a following code block contains hidden lines (///# ...).

Here's a minimal example:

/// Removing this very line makes it render correctly.
///
/// # I will not be rendered correctly
///
/// ```
///# fn foo() {} // A hidden line like this needs to exist
/// ```
pub fn some_item() {}

And this is what it looks like:
rustdoc_bug

I've set up a repository with this example to play around with here: https://github.com/panicbit/rustdoc_bug_33771

cc @Manishearth

@GuillaumeGomez
Copy link
Member

There are other similar issues reported about the markdown parser (can't find them however...). Thanks for reporting one more. 😃

@apasel422 apasel422 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label May 21, 2016
@alilleybrinker
Copy link
Contributor

@GuillaumeGomez, it looks like the current Rustdoc Markdown parser is using Hoedown, which hasn't been updated in a while. Is there any interest in switching to a different Markdown parser? It seems to me that writing a good pure-Rust markdown parser that could be used in Rustdoc would also be more broadly useful.

@hanna-kruppe
Copy link
Contributor

Well there's pulldown-cmark, used by mdBook.

@GuillaumeGomez
Copy link
Member

@AndrewBrinker: If you find one or write one, then sure.

@steveklabnik
Copy link
Member

I would be very interested in moving to pull down-cmark or something else CommonMark compliant.

On Jun 10, 2016, 11:58 +0300, Guillaume Gomeznotifications@github.com, wrote:

@AndrewBrinker(https://github.com/AndrewBrinker): If you find one or write one, then sure.


You are receiving this because you are subscribed to this thread.
Reply to this email directly,view it on GitHub(#33771 (comment)), ormute the thread(https://github.com/notifications/unsubscribe/AABsikYSELwsHZaAr6ILqNXAceL49MI8ks5qKScegaJpZM4IjwxD).

@Luthaf
Copy link

Luthaf commented Oct 22, 2016

I would be very interested in moving to pull down-cmark or something else CommonMark compliant.

What would be the plan here? I think making a full switch on the first time would not be a good idea, so maybe two backends (hoedown and pulldown-cmark) should work together for a few time. What would be the better way to have both exposed? A rustdoc flag?

@steveklabnik
Copy link
Member

steveklabnik commented Oct 25, 2016 via email

@frewsxcv
Copy link
Member

Opened an issue for moving to pulldown-cmark: #38400

@BurntSushi
Copy link
Member

BurntSushi commented May 14, 2017

Within the last couple of weeks, I've seen this bug appear quite frequently. (I have never seen it before.) As in, a significant number of headers in my docs aren't rendering properly as described in the OP.

@GuillaumeGomez
Copy link
Member

I'd prefer to wait for the switch to pulldown to be officially complete to check if we still have this issue because it seems to be very specific to hoedown.

@steveklabnik steveklabnik added T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. and removed T-tools labels May 18, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 25, 2017
@panicbit
Copy link
Contributor Author

As already suspected, this seems to be fixed with the pulldown parser.

correct

Rustdoc also correctly warns about this change:

WARNING: rendering difference in `Removing this very line makes it render correctly.`
   --> src/lib.rs:8:0
    /html[0]/body[1] Tags differ: expected: `h1`, found: `p`

@GuillaumeGomez
Copy link
Member

Then let's close this issue once the switch to pulldown is complete.

@kzys
Copy link
Contributor

kzys commented Aug 15, 2018

#47398 and #48274 have been merged. We probably can close this issue 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests