shiki-git-diff
v0.0.4
Published
Display git patch in shiki with syntax highlighting of the original language.
Readme
shiki-git-diff
Install
pnpm add shiki-git-diffConfigure
import { shikiGitDiff, shikiGitDiffOptions } from "shiki-git-diff";
// ...
transformers: [
shikiGitDiff({
// default options
classLineAdd: "add",
classLineRemove: "remove",
classActivePre: "diff",
condition = ctx => ctx.options?.meta?.["__raw"]?.endsWith(".diff"),
}),
],
// ...Display
code > [data-line] {
&.diff.add {
background-color: rgba(67, 218, 64, 0.3);
}
&.diff.remove {
background-color: rgba(229, 38, 38, 0.3);
}
}