To demonstrate the addition and removal of lines, you can use the add
and remove
keywords.
Torchlight will look through your theme to find the appropriate foreground and background colors to apply to the specific lines.
It will also apply line-add
and line-remove
classes to the individual lines. To the code element it will apply the has-diff-lines
class, and potentially has-add-lines
and has-remove-lines
.
1return [ 2 'extensions' => [ 3 // Add attributes straight from markdown. 4 AttributesExtension::class, 5 6 // Add Torchlight syntax highlighting. 7 SomeOtherHighlighter::class, // [tl! remove] 8 TorchlightExtension::class, // [tl! add] 9 ]10]
1return [ 2 'extensions' => [ 3 // Add attributes straight from markdown. 4 AttributesExtension::class, 5 6 // Add Torchlight syntax highlighting. - SomeOtherHighlighter::class, + TorchlightExtension::class, 9 ]10]
You can use ++
and --
as shorthand for add
and remove
.
1return [ 2 'extensions' => [ 3 // Add attributes straight from markdown. 4 AttributesExtension::class, 5 6 // Add Torchlight syntax highlighting. 7 SomeOtherHighlighter::class, // [tl! --] 8 TorchlightExtension::class, // [tl! ++] 9 ]10]
1return [ 2 'extensions' => [ 3 // Add attributes straight from markdown. 4 AttributesExtension::class, 5 6 // Add Torchlight syntax highlighting. - SomeOtherHighlighter::class, + TorchlightExtension::class, 9 ]10]
To learn more about controlling the +
/-
indicators of diffs, head to the diff indicators page.
The diff annotations support the entire set of range modifiers to help you quickly annotate a whole set of lines.
Check out the range docs for more details, but here is a quick cheat sheet.
1add -- This line only 2 3add:start -- The start of an open ended range 4add:end -- The end of an open ended range 5 6add:10 -- This line, and the 10 following lines 7add:-10 -- This line, and the 10 preceding lines 8 9add:1,10 -- Start one line down, highlight 10 lines total10add:-1,10 -- Start one line up, highlight 10 lines total