-
Notifications
You must be signed in to change notification settings - Fork 2
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
If there is no H1, do not indent H2 #6
Comments
@itsonlyjames maybe we can discuss here |
Agreed. I use Linter to automatically adjust the hierarchy for my notes and as such any H4s under H2s get automatically converted to H3s, however let's assume most users don't have this and as such we can indent based on I think the last 2 items are rather similar, and my initial thoughts are we respect the inline title setting, so if there is a H1 displayed in the page, that gets rendered in the sticky heading element. Now, it could be considered redundant because the page title is right above this, however it is for the click functionality to go back to the top rather than clicking the page title to rename. I press I think we respect inline title by default, sticking H1 if it is there, and not if it is not, and then add a setting to this plugin that is along the lines of "Page header sticky: boolean, default true" so that should a user have an inline title, but not wish it to be stuck, this alleviates that and allows all options here to be considered and up to the user. What do you think @zhouhua? |
Turns out inline title is not considered a "heading element" in terms of HTML, so it's not a H1, we would need to manually push that into the headings array. However I've gone ahead and opened a CSS PR: #7, pull it and check it out |
Regarding inline titles, my thoughts are more complex. When should they be displayed? When should they not be displayed? How should they be displayed?
|
Oh, most of what I mentioned above pertains to the default mode. |
This feature is complete. |
This is such an interesting discussion because you are thinking about this in such an abstract way, it's brilliant. Whereas my view is much more focused on structure, all of my notes follow the same structure. The page title is the H1, and any heading within the document is then considered subordinate to that Page title—H1. So for me inline title, while it makes sense to include in the sticky, it does then, like you say, interfere with the other options where users might have both page title and H1's... In this case, with my relatively simple thinking of this, and seeking a simple solution, I think your idea is best. We had an option to stick the Page Title as H0, and then any H1s would be indented once, and H2s would be indented twice, and so on... I would not need to turn this setting off/on because I don't have the inline page title enabled, which means it could never stick when there's no inline title. However the option existing should users have the inline title enabled, would then allow all combinations to be considered. So I think of these scenarios (within the sticky header):
Altering Indent level meaningsThis does also raise a concern of mine that indent level should be indexed, so the first element with no indent is not level 1 but 0. Indent level 1 to me means it is indented 1 level
This would better suit the implementation of inline title also, because it could look like so:
|
You are correct, but what I speak of is highly low level and pendantic in regards to logic. I have created this PR for you to visualise: #14 |
For web-based document editors, there is an interesting issue regarding headings. HTML defines six levels of headings, from h1 to h6, but it's recommended to have only one h1 heading. This means that if you follow this convention, the main body of a document can only start from h2 as the first-level outline, while h1 should be reserved for the overall title of the document.For web-based document editors, there is an interesting issue regarding headings. HTML defines six levels of headings, from h1 to h6, but it's recommended to have only one h1 heading. This means that if you follow this convention, the main body of a document can only start from h2 as the first-level outline, while h1 should be reserved for the overall title of the document.
Different document editors often handle this issue in various ways. Based on my knowledge, here are a few possible approaches:
So, to enhance the user experience of this plugin, the following optimizations can be made:
The text was updated successfully, but these errors were encountered: