Renders the line as an addition.
Diff Highlighting
1 min readStableIntermediate
Show changes inline using // [!code ++] and // [!code --] markers, or use the diff language for a +/- view.
Quick Start
Use the diff language for a pure addition/removal view.
Diff
Diff
- const old = true
+ const updated = true
Adding Options
Use inline comment markers to keep the language's normal syntax highlighting.
TypeScript
TypeScript
function getConfig() {
return {
theme: 'light',
theme: 'dark',
}
}Advanced
Combine several add/remove markers in one block to show a full change set.
lib/config.ts
TypeScript
function getConfig() {
return {
theme: 'light',
theme: 'dark',
debug: true,
debug: false,
}
}Options
Markers are recognized in //, #, /* */, and <!-- --> comment styles, and are stripped from the rendered line.
// [!code ++]marker// [!code --]markerRenders the line as a removal.
difflanguageToggles the diff language for +/- lines.
Related pages
Was this page helpful?