Allow to highlight lines in a code block (github flavored markdown) #42489
Replies: 8 comments 2 replies
|
No updates or mentions of this feature? 😢 |
|
As a workaround, you can utilise Github flavoured Markdown diff attribute. So, instead of specifying a language after your 3 backticks, you could specify diff. Example: + Chelsea are going to be Premier League Champions 2023/2024
- Arsenal are going to be Premier League Champions 2023/2024 |
|
Highlighting lines is fine, but it could also be interesting to add some way to highlight arbitrary chunks of text, for example by using a single backtick character. This might make things slightly incompatible with vanilla Markdown, since there's supposed to be nothing inside a code block that can be parsed as markup - but I suppose that can be mitigated by using a directive at the beginning, and it would not break existing parsers, it would just cause these backtick characters to be displayed. This is what I mean: Does this make sense? |
|
This would be nice. What would also be nice is being able to make characters bold or italicised in code blocks to emphasis small changes in bigger blocks: foo = bar(**_baz_**) # doesn't workIt works in quote blocks
|
|
To add to the existing implementations: Vitepress one. |
|
Nearly 3 years ago and still no answer from GitHub. |
|
The place for discussing extensions to Commonmark, the base of GFM, also has a thread on extending the info string of fenced code blocks to support line numbering etc. (and several related ones). Although extensions will not be added to CM before it reaches v1.0 (if ever), this still seems like a better way forward than hoping for Github to add this unilaterally. |
|
See also my feature request here https://github.com/orgs/community/discussions/153645 and a very small amount of updates/news from GitHub |
Uh oh!
There was an error while loading. Please reload this page.
Select Topic Area
Product Feedback
Body
where:
what i like:
I have a fenced code blocks. I like to mark some lines as highlighted.
To highlight lines, you can use one of the following directives as comments in your code:
highlight-linehighlights the current line;highlight-next-linehighlights the next line;highlight-starthighlights the lines until the matching hightlight-end;highlight-range{1, 4-6}will highlight the next line, and the fourth, fifth and sixth lines.since detecting comments of a specific language and removing code i would not prefer i suggest a marker at the start of the codeblock would be also enough for this line highlighting:
or better as a named property
named properties are better so that this is open for other properties like
title=existing implementations and examples
see: https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-remark-prismjs#line-highlighting
Note:
with highlight I don't mean syntax highlighting for a specific language. this is still available as:
All reactions