Skip to content

Commit 140d9c7

Browse files
authored
Improve code diff rendering styles (#184)
* Update update docusaurus to canary version to allow for starting codeblock line number to be set * Add start/end magic comments for diffs so each line does not need to be individually annotated * Fix alignment issues when diffs and line numbers are displayed at the same time * Replace default space character with empty string * Refactor styles
1 parent 09e434d commit 140d9c7

File tree

4 files changed

+4385
-2446
lines changed

4 files changed

+4385
-2446
lines changed

docusaurus.config.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,12 +561,20 @@ ${content}`,
561561
darkTheme: prismThemes.dracula,
562562
magicComments: [
563563
{
564-
className: 'code-block-diff-add-line',
565-
line: 'diff-add'
564+
className: "code-block-diff-add-line",
565+
line: "diff-add",
566+
block: {
567+
start: "diff-add-start",
568+
end: "diff-add-end"
569+
}
566570
},
567571
{
568-
className: 'code-block-diff-remove-line',
569-
line: 'diff-remove'
572+
className: "code-block-diff-remove-line",
573+
line: "diff-remove",
574+
block: {
575+
start: "diff-remove-start",
576+
end: "diff-remove-end"
577+
}
570578
}
571579
]
572580
},

0 commit comments

Comments
 (0)