Highlight specific lines in code block

Thanks for the great app.

Use case or problem

When I write a tutorial or a blog, I want to make the differences clear between two related code block. To highlight specific lines seems a good way to solve it.


This is a snippet in react document.

Proposed solution

Since I notice a same request in plugin request category yesterday, I have tried to write a plugin to accomplish the request.

I think ```lang {4}, ```lang {6-10}, ```lang {4, 6-10} would be a good way to define specific lines that should be highlighted.

but I finally got failed, it seems difficult to add line highlight and keep syntax highlight at the same time. Recognize the code block that needs this functionality and read parameters defined by user are also puzzles to me.

Related feature requests (optional)

If this request is accepted, I think a parameter to control if line number should display is also or it will be a troublesome task to count lines to specify highlight parameter. now this feature is provided by custom plugin but only in preview mode, but the flow that check in preview mode then go back to edit mode to specify parameter looks not that elegant.

2 Likes