-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
highlight: Add tabindex when code is not highlighted #8917
Conversation
We have, I think, at least one other issue discussing using the default Chroma lexer when no lexer is given. Would that not fix this issue? |
I opened this upstream: yuin/goldmark-highlighting#22 If that's accepted in a way that the code will always be highlighted (in the limit with the fallback lexer) and not as a flag, then yes, |
OK, so if we enable |
The situations in which the code is not highlighted (
If |
If I'm reading the above correctly, we should get a better situation by setting the |
That's correct, but currently that's linked to Hugo's I think Chroma doesn't do much guessing still, but otherwise I'm usually not a big fan of guessing because of my experience with highlight.js, which does some weird highlightings when it tries to guess languages: |
It doesn't, I had a look some time ago. |
OK, thinking about it -- I'll merge this, and then follow up this upstream. |
TBH the main reason I raised this PR was because I was just scrolling through the code trying to figure out where the recently raised issues about highlighting come from, and liked how nice and symmetric this part of the code turned out 😃 hugo/markup/goldmark/convert.go Lines 318 to 330 in 7a15eda
|
Yes, that's pretty code. |
Looking further into it, even the The problem with the current overlap is that issues with a similar symptom like #8824 and #8913 need to be fixed in two different places -- the former in Hugo, the latter in goldmark-highlighting. |
The new highlighter does not work to well if no syntax is specified for the code block / code fence / indention. See gohugoio/hugo#8917
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
PR #8568 added
tabindex="0"
to most<pre>
tags, but it's still missing when using code fences and goldmark-highlighting doesn't highlight that code block. This PR fixes it by making this scenario reuse the same code that was changed in the aforementioned PR.