-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
🐛 BUG: footnotes in markdown generate a <h2 id="footnote-label" class="sr-only">Footnotes</h2> that cannot be translated or removed #3163
Comments
So, about the Here is an example: https://github.com/gatsbyjs/gatsby/blob/master/examples/using-remark/src/pages/2016-04-15---hello-world-kitchen-sink/index.md you can see in the css that this That is a Gastby example, but rendered in github, here is the version rendered by Gatsby for comparison: https://using-remark.gatsbyjs.org/hello-world-kitchen-sink/ it doesn't have this This is where this This is the part that tests for the options to make it translatable: https://github.com/syntax-tree/mdast-util-to-hast/blob/main/lib/index.js#L121-L122 It just tests if the value is falsey, so setting the option to an empty string will show the English version. I guess i am going down a pretty deep rabbit hole here, but it could be that having an |
One more thing: confusingly there is also a |
This documents how to use the changes made in withastro/astro#3297 in order to close withastro/astro#3163
What version of
astro
are you using?1.0.0-beta.12
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Linux
Describe the Bug
Footnotes in Mardown are managed through remark-gfm. I got pretty confused looking at the chain of things happening during the transformation, but ultimately it will create a
<h2 id="footnote-label" class="sr-only">Footnotes</h2>
at the beginning of the section.This is an issue for internationalization as we need to be able to (at least) translate this to the site's language, if not customize this html.
Remark-rehype takes an option for this: https://github.com/remarkjs/remark-rehype#optionsfootnotelabel
Note that the documentation mentions "Affects screen readers. Change it when the markdown is not in English."
But this is not reachable through the astro config file. It is possible to add this option right after this:
astro/packages/markdown/remark/src/index.ts
Line 69 in becdf3e
I am also wondering about the
sr-only
class here. Given what the documentation is saying, i am wondering if this title is specifically added for screen readers, and if it is expected that this would be hidden otherwise through css. I find it a bit obvious that this section contains footnotes and would rather do away with this title entirely. But I don't use a screen reader and it might very well be that it helps in this case.I can try to write a PR for making the remark-rehype options available, but am not 100% sure what the general direction should be!
Link to Minimal Reproducible Example
https://stackblitz.com/github/yqniarrrp?file=src/pages/index.md
Participation
The text was updated successfully, but these errors were encountered: