Skip to content

Incorrect Headline Hierarchy in Rust Book #20826

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

Closed
killercup opened this issue Jan 9, 2015 · 5 comments
Closed

Incorrect Headline Hierarchy in Rust Book #20826

killercup opened this issue Jan 9, 2015 · 5 comments
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@killercup
Copy link
Member

In the markdown files, a number sub-chapter headlines seem to be first level ones (single #), resulting in h1s in the output. The chapter title is rendered as a h1 as well. This is semantically wrong—the content contains subheadings to the chapter.

An example is the chapter The Rust Testing Guide. It should be noted that some chapters do use second level headlines, e.g. Compound Data Types.

Since the chapter heading is not inserted as a regular headline but as special title attribute (%), it is debatable what is the correct content headline level is.

Two possible ways to fix this:

  • Change all files to contain at most second level headlines
  • Change rustbook to increment headline levels by one

cc @steveklabnik

@steveklabnik steveklabnik added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed A-docs labels Jan 9, 2015
@steveklabnik
Copy link
Member

I think this is a dup of another Rustdoc issue, but I can't find it at the moment. It should be handled at the rustdoc layer.

@tomjakubowski
Copy link
Contributor

I think I know what issue you mean and it doesn't seem like a dupe of that to me. The root of that issue ultimately was that API docs are made up of doc comment blocks on individual items. Since each doc comment block compromises a whole "subdocument" of sorts, there's no way for the headings in a doc comment block to "know" which level they ought to be, because they don't know where or how they'll be inserted in a larger document (the whole API docs on a module or item or whatever).

Here, we just have long prose documents that simply need to be marked "down" correctly but aren't right now.

@killercup
Copy link
Member Author

Is this actually something to be handled/added at the rustdoc layer or just a parameter that rustbook neeeds to set when calling rustdoc? (Or maybe both?)

I haven't found that issue you referred to either. I may have an idea for the API docs, though. I've opened #20863 for this. If you find that other issue, just close this new one.

akavel added a commit to akavel/rust that referenced this issue Jan 10, 2015
Doc headings in The Book sometimes started from level 1 (#), sometimes
from level 2 (##). Normalize to always be 2nd level and deeper only.
(Issue rust-lang#20826.)
@akavel
Copy link
Contributor

akavel commented Jan 10, 2015

I've created a pull request, in case moving all headings 1 level "down" in all files where there are 1st level headings is an acceptable solution to this issue. (I've done this only for The Book.)

@steveklabnik
Copy link
Member

Triage: this still happens, but yeah, this is part of just how Markdown works, I'd say, echoing @tomjakubowski . Closing as not a bug. If we have incorrect markup generated, we should fix it in the source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

5 participants