Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
librustdoc: Use correct heading levels. #89506
librustdoc: Use correct heading levels. #89506
Changes from 1 commit
a8a40ea
4a6aa6e
6518a0a
13558ee
f1425c7
08a4f24
742d8be
1f86a8e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks incorrect to me.
H1
should equal1
, no? Otherwise, it seems we'd get<h0>...</h0>
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I'd much rather we have a
fn level(&self) -> u32
method than relying on enum casting. Casting makes it harder to see where the enum's being converted to a number.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, 0 is correct. The numbers there are added to the level specified in the Markdown file, so “# ghir” gets turned into h1, because it’s (1 + 0).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an offset, so it gets added to the normal heading level. e.g.
HeadingOffset::H2
means you add 1 level so# this is an h2
and## this is an h3
. MaybeHeadingStart
would be a clearer name?I agree with you on
fn level(&self)
.Edit: oops, i did not see you had already responded 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, that makes sense. Personally, I'd think it'd be clearer to use
struct HeadingOffset { offset: u32 }
or something like that. HavingH1...H6
variants makes it look like it represents<h1>
through<h6>
.