From 7ebd32ee99bb20096439979f40572ef21a9ff99b Mon Sep 17 00:00:00 2001 From: Jacob Date: Tue, 16 Dec 2025 22:20:15 +0100 Subject: [PATCH 1/3] Improve docs embed files code fragment --- docs/embed-files.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/embed-files.md b/docs/embed-files.md index aba1bfaaf..f4e74565f 100644 --- a/docs/embed-files.md +++ b/docs/embed-files.md @@ -65,9 +65,11 @@ Sometimes you don't want to embed a whole file. Maybe because you need just a fe ``` In your code file you need to surround the fragment between `/// [demo]` lines (before and after the fragment). -Alternatively you can use `### [demo]`. By default, only identifiers are omitted. To omit the entire line containing the identifier in the fragment output, you can add the `:omitFragmentLine` option. +Alternatively you can use `### [demo]`. By default, only identifiers are omitted. To omit the entire line containing the identifier in the fragment output, add the `:omitFragmentLine` option. This is useful if your code fragment is e.g. HTML and you want to hide the Docsify fragment identifier from showing in your HTML source. `` in your source file and `:omitFragmentLine` will make the `-->` not show up in your Docsify code fragment section. -Example: +Example ([\_media/example.js](/_media/example.js ':ignore')): + +`[filename](_media/example.js ':include :type=code :fragment=demo')` [filename](_media/example.js ':include :type=code :fragment=demo') From 45be7c9dc9755dce1737e4f2043f97b9a6b30feb Mon Sep 17 00:00:00 2001 From: Jacob Date: Wed, 17 Dec 2025 21:50:44 +0100 Subject: [PATCH 2/3] Remove leading slash docs link --- docs/embed-files.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/embed-files.md b/docs/embed-files.md index f4e74565f..82b98d27d 100644 --- a/docs/embed-files.md +++ b/docs/embed-files.md @@ -67,7 +67,7 @@ Sometimes you don't want to embed a whole file. Maybe because you need just a fe In your code file you need to surround the fragment between `/// [demo]` lines (before and after the fragment). Alternatively you can use `### [demo]`. By default, only identifiers are omitted. To omit the entire line containing the identifier in the fragment output, add the `:omitFragmentLine` option. This is useful if your code fragment is e.g. HTML and you want to hide the Docsify fragment identifier from showing in your HTML source. `` in your source file and `:omitFragmentLine` will make the `-->` not show up in your Docsify code fragment section. -Example ([\_media/example.js](/_media/example.js ':ignore')): +Example ([\_media/example.js](_media/example.js ':ignore')): `[filename](_media/example.js ':include :type=code :fragment=demo')` From a3fdf55743aa0a19e7f82af21669fa223fae23bd Mon Sep 17 00:00:00 2001 From: Jacob Date: Sat, 20 Dec 2025 11:22:57 +0100 Subject: [PATCH 3/3] Add code embed example files embedded in docs --- docs/embed-files.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/embed-files.md b/docs/embed-files.md index 82b98d27d..51d603863 100644 --- a/docs/embed-files.md +++ b/docs/embed-files.md @@ -67,9 +67,23 @@ Sometimes you don't want to embed a whole file. Maybe because you need just a fe In your code file you need to surround the fragment between `/// [demo]` lines (before and after the fragment). Alternatively you can use `### [demo]`. By default, only identifiers are omitted. To omit the entire line containing the identifier in the fragment output, add the `:omitFragmentLine` option. This is useful if your code fragment is e.g. HTML and you want to hide the Docsify fragment identifier from showing in your HTML source. `` in your source file and `:omitFragmentLine` will make the `-->` not show up in your Docsify code fragment section. -Example ([\_media/example.js](_media/example.js ':ignore')): +Example: The file [\_media/example.js](_media/example.js ':ignore') contains `/// [demo]` identifiers: -`[filename](_media/example.js ':include :type=code :fragment=demo')` +```markdown +[filename](_media/example.js ':include :type=code') +``` + +⬇️ + +[filename](_media/example.js ':include :type=code') + +Adding the `:fragment=demo` results in the following: + +```markdown +[filename](_media/example.js ':include :type=code :fragment=demo') +``` + +⬇️ [filename](_media/example.js ':include :type=code :fragment=demo')