-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
docs: Fix keywords for line highlighting in code blocks #18196
Conversation
|
||
```` | ||
```javascript:title=gatsby-config.js | ||
module.exports = { | ||
siteMetadata: { | ||
title: `GatsbyJS`, | ||
// highlight-next-line | ||
// keyword |
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 suppose this could get confusing.
Any way we can keep the keyword and escape it so that the plugin doesn't actually highlight the snippet?
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.
@sidharthachatterjee my first thought was to include a screenshot but that seems like not a good pattern to start. I think the point of the keyword highlighting is to always highlight snippets (pretty sure it's configured in gatsby-remark-prismjs
) - so really no way to turn it off?
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.
We could set the language to none
to disable all syntax highlighting on that snippet, I guess. What do you think?
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.
oh good idea! let me try that
Looks like #17213 is relevant to this |
3 PR's so far! 😅will take a look |
@thomaswangio Looks like you might need to update a failing test |
Yep, trying to figure that out now, spoke too soon 😅 edit: woohoo! changed empty named code blog to named |
@dkthehuman @aditsachde @sidharthachatterjee @DSchau @pieh @marcysutton tagging all contributors involved with the 3 PRs! Let me know if this solution satisfies the issue 😇 |
what about using no-highlight instead of just none? (sorry for the bikeshed) |
thanks @wardpeet! that's probably more explicit, updated! |
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 is great! Thank you so much, Thomas 🥇
Description
Highlighting comment needs to be visible in the examples for Code formatting: Line highlighting. I fixed this behavior by adding the condition for highlighting only when className is not
language-none
. So now if you add the language keywordnone
to code blocks in markdown, it will stop the highlighting behavior from/www/src/components/code-block/normalize.js
.As suggested by @DSchau #17213 (comment).
See result below.
Related PRs
#17213
#18294