-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
[V2] Potential code block improvements #2271
Copy link
Copy link
Closed
Labels
difficulty: intermediateIssues that are medium difficulty level, e.g. moderate refactoring with a clear test plan.Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan.featureThis is not a bug or issue with Docusausus, per se. It is a feature request for the future.This is not a bug or issue with Docusausus, per se. It is a feature request for the future.good first issueIf you are just getting started with Docusaurus, this issue should be a good place to begin.If you are just getting started with Docusaurus, this issue should be a good place to begin.help wantedAsking for outside help and/or contributions to this particular issue or PR.Asking for outside help and/or contributions to this particular issue or PR.
Description
Metadata
Metadata
Assignees
Labels
difficulty: intermediateIssues that are medium difficulty level, e.g. moderate refactoring with a clear test plan.Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan.featureThis is not a bug or issue with Docusausus, per se. It is a feature request for the future.This is not a bug or issue with Docusausus, per se. It is a feature request for the future.good first issueIf you are just getting started with Docusaurus, this issue should be a good place to begin.If you are just getting started with Docusaurus, this issue should be a good place to begin.help wantedAsking for outside help and/or contributions to this particular issue or PR.Asking for outside help and/or contributions to this particular issue or PR.
Type
Fields
Give feedbackNo fields configured for issues without a type.
🚀 Feature
v2 code blocks currently have the ability to highlight specific line numbers, like this:
However, highlighting lines based on line numbers is somewhat difficult to use.
The
gatsby-remark-prismjsplugin has the ability to highlight individual lines by putting a// highlight-next-linecomment in front, or highlight ranges of lines using// highlight-startand// highlight-endpairs. It looks like the logic is implemented in thisdirectives.jsfile.This would be a great addition to the Docusaurus Prism plugin.
In addition, I've seen that many docs websites have code snippets that include a filename in front of the block, such as Gatsby (example) and Ember (example).
Gatsby's Markdown for this looks like:
Have you read the Contributing Guidelines on issues?
Yes
Motivation
Easier line highlights and filenames would be very useful, especially as part of tutorials that are telling users what to edit.