Skip to content

Commit 29ed781

Browse files
authored
docs: Improve embed files code fragment (docsifyjs#2650)
1 parent f99e865 commit 29ed781

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

docs/embed-files.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,21 @@ Sometimes you don't want to embed a whole file. Maybe because you need just a fe
6565
```
6666

6767
In your code file you need to surround the fragment between `/// [demo]` lines (before and after the fragment).
68-
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.
68+
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. `<!-- /// [demo] -->` in your source file and `:omitFragmentLine` will make the `-->` not show up in your Docsify code fragment section.
6969

70-
Example:
70+
Example: In the source file \_media/example.js, `/// [demo]` identifiers have been included:
71+
72+
```markdown
73+
[filename](_media/example.js ':include :type=code')
74+
```
75+
76+
[filename](_media/example.js ':include :type=code')
77+
78+
Adding the `:fragment=demo` results in the following:
79+
80+
```markdown
81+
[filename](_media/example.js ':include :type=code :fragment=demo')
82+
```
7183

7284
[filename](_media/example.js ':include :type=code :fragment=demo')
7385

0 commit comments

Comments
 (0)