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

Heading tag should not be used as title of the blocks/admonitions #43

Open
amimas opened this issue Mar 16, 2021 · 2 comments
Open

Heading tag should not be used as title of the blocks/admonitions #43

amimas opened this issue Mar 16, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@amimas
Copy link

amimas commented Mar 16, 2021

The plugin currently generates an html code where the title of the special notes/admonitions are given an html heading h5.

return `
<div class="admonition admonition-${token.admonition}">
<div class="admonition-heading">
<h5>${iconTemplate} ${token.title || token.admonition}</h5>
</div>
<div class="admonition-content">
`;

This is an issue from both semantics and accessibility aspect. If I have the following structure in my markdown:

# My page/document title

## Section heading

Some introduction about this heading and here's a special note:

:::caution Something to keep in mind
some text here
:::

...

The above will produce the following hierarchy when the html page is generated:

h1 My page/document title

h2 Section heading

Some introduction about this heading and here's a special note:

h5 Something to keep in mind
some text here
...

Semantically that's inaccurate because after h2, the next sub-heading should be h3. For the same reason, it also fails the accessibility tests in Google's Lighthouse audit.

I think this plugin should not use h5 as the title of the notes. It can probably use a span (or something more appropriate) with a classname and then adjust the font size accordingly.

@leonardfactory
Copy link
Member

Seems right to me. Maybe I'll add an option to revert to previous behaviour if someone has an issue with this (even if I don't see how).

@leonardfactory leonardfactory added the enhancement New feature or request label Mar 19, 2021
@amimas
Copy link
Author

amimas commented Mar 20, 2021

Sounds good. I didn't know this was changed in new version. I'd probably go for reverting this change instead of adding option to maintain something that is not correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants