Skip to content

fix(docusaurus): support diff code blocks #4156 #4158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ module.exports = {
prism: {
theme: { plain: {}, styles: [] },
// https://github.com/FormidableLabs/prism-react-renderer/blob/e6d323332b0363a633407fabab47b608088e3a4d/packages/generate-prism-languages/index.ts#L9-L25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's update this comment:

Suggested change
// https://github.com/FormidableLabs/prism-react-renderer/blob/e6d323332b0363a633407fabab47b608088e3a4d/packages/generate-prism-languages/index.ts#L9-L25
// Prism provides a [default list of languages](https://github.com/FormidableLabs/prism-react-renderer/blob/e1c83a468b05df7f452b3ad7e4ae5ab874574d4e/packages/generate-prism-languages/index.ts#L9-L26).
// A list of [additional languages](https://prismjs.com/#supported-languages) that are supported can be found at their website.

additionalLanguages: ['shell-session', 'http'],
additionalLanguages: ['shell-session', 'http', 'diff'],
},
algolia: {
appId: 'O9QSL985BS',
Expand Down
6 changes: 3 additions & 3 deletions src/styles/components/_code.scss
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ pre[class*='language-'] {
.token.selector,
.token.char,
.token.function,
.token.builtin,
.token.inserted {
.token.builtin {
color: #ff6810;
}

Expand All @@ -149,7 +148,8 @@ pre[class*='language-'] {
.token.attr-value,
.language-css .token.string,
.style .token.string,
.token.variable {
.token.variable,
.token.inserted {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment of what .token.inserted does so it's easier for us to debug. There's a lot of old code in this repo that we're not sure what's needed or not. By providing comments like these, we can start to figure out what is important.

Suggested change
.token.inserted {
// Code additions (indicated by a leading '+') within a diff.
.token.inserted {

Do the same for .token.deleted:

// Code removals (indicated by a leading '-') within a diff.
.token.deleted {

color: #42b983;
}

Expand Down