From f532139362ce158b54c9bf6d2c0fb486d8623be6 Mon Sep 17 00:00:00 2001 From: dks333 Date: Tue, 17 Jun 2025 14:45:00 -0700 Subject: [PATCH 1/2] add diff in code block --- code.mdx | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/code.mdx b/code.mdx index 695485c0..c612794b 100644 --- a/code.mdx +++ b/code.mdx @@ -58,7 +58,7 @@ You can add meta options to your code blocks to customize their appearance. Enable syntax highlighting by specifying the programming language after the opening backticks of a code block. -We use Shiki for syntax highlighting and support all available languages. See the full list of [languages](https://shiki.style/languages) in Shiki's documentation. +We use [Shiki](https://shiki.style/) for syntax highlighting and support all available languages. See the full list of [languages](https://shiki.style/languages) in Shiki's documentation. ```java class HelloWorld { @@ -300,3 +300,27 @@ function sayHello() { sayHello(); ``` ```` + +### Diff + +Use `[!code ++]` and `[!code --]` to mark added and removed lines (add single line comments to the code). You can also mark multiple lines with a single comment, such as `[!code ++:3]` or `[!code --:5]`. + +```js Diff Example icon="code" lines +const greeting = "Hello, World!"; // [!code ++] +function sayHello() { + console.log("Hello, World!"); // [!code --] + console.log(greeting); // [!code ++] +} +sayHello(); +``` + +````mdx +```js Diff Example icon="code" lines +const greeting = "Hello, World!"; // [\!code ++] +function sayHello() { + console.log("Hello, World!"); // [\!code --] + console.log(greeting); // [\!code ++] +} +sayHello(); +``` +```` \ No newline at end of file From 89bdffcc90f5bd2886d7da270e32e7f6c6b170aa Mon Sep 17 00:00:00 2001 From: "Kaishan (Sam) Ding" <52273168+dks333@users.noreply.github.com> Date: Tue, 17 Jun 2025 14:56:48 -0700 Subject: [PATCH 2/2] Update code.mdx Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com> --- code.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code.mdx b/code.mdx index c612794b..427d85b9 100644 --- a/code.mdx +++ b/code.mdx @@ -303,7 +303,7 @@ sayHello(); ### Diff -Use `[!code ++]` and `[!code --]` to mark added and removed lines (add single line comments to the code). You can also mark multiple lines with a single comment, such as `[!code ++:3]` or `[!code --:5]`. +Add single line comments with `[!code ++]` and `[!code --]` to mark added and removed lines. You can also mark multiple lines with a single comment, such as `[!code ++:3]` or `[!code --:5]`. ```js Diff Example icon="code" lines const greeting = "Hello, World!"; // [!code ++]