Skip to main content
OwnDocs

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

Renders the line as an addition.

// [!code --]marker

Renders the line as a removal.

difflanguage

Toggles the diff language for +/- lines.

Was this page helpful?