feat: support focus, colored diffs, error highlights in code blocks #1534
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #830
Fixes #1314
This pull request adds support for colored diffs and focused lines in code blocks. This is done thanks to
shiki-processor
, which makes possible to add custom processors that act on a code snippet.Specifically, the
focus
,diff
andhighlight
processors are added. They work by adding a// [!code <tag>]
comment inline, similar to Torchlight.In a follow-up PR or in this one if you agree, it would be nice to add support for userland to provide processors as well.
Here is a preview of the line focusing:
CleanShot.2022-10-25.at.15.32.32.mp4
And here is what the colored line diffing looks like: