Skip to content

Commit c78df99

Browse files
fix(docusaurus): support diff code blocks #4156 (#4158)
Co-authored-by: Maria Hutt <thetaPC@users.noreply.github.com>
1 parent e9f872e commit c78df99

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

docusaurus.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,9 @@ module.exports = {
323323
},
324324
prism: {
325325
theme: { plain: {}, styles: [] },
326-
// https://github.com/FormidableLabs/prism-react-renderer/blob/e6d323332b0363a633407fabab47b608088e3a4d/packages/generate-prism-languages/index.ts#L9-L25
327-
additionalLanguages: ['shell-session', 'http'],
326+
// Prism provides a [default list of languages](https://github.com/FormidableLabs/prism-react-renderer/blob/e1c83a468b05df7f452b3ad7e4ae5ab874574d4e/packages/generate-prism-languages/index.ts#L9-L26).
327+
// A list of [additional languages](https://prismjs.com/#supported-languages) that are supported can be found at their website.
328+
additionalLanguages: ['shell-session', 'http', 'diff'],
328329
},
329330
algolia: {
330331
appId: 'O9QSL985BS',

src/styles/components/_code.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ pre[class*='language-'] {
137137
.token.selector,
138138
.token.char,
139139
.token.function,
140-
.token.builtin,
141-
.token.inserted {
140+
.token.builtin {
142141
color: #ff6810;
143142
}
144143

@@ -149,7 +148,9 @@ pre[class*='language-'] {
149148
.token.attr-value,
150149
.language-css .token.string,
151150
.style .token.string,
152-
.token.variable {
151+
.token.variable,
152+
// Code additions (indicated by a leading '+') within a diff.
153+
.token.inserted {
153154
color: #42b983;
154155
}
155156

@@ -175,6 +176,7 @@ pre[class*='language-'] {
175176
cursor: help;
176177
}
177178

179+
// Code removals (indicated by a leading '-') within a diff.
178180
.token.deleted {
179181
color: red;
180182
}

0 commit comments

Comments
 (0)