Skip to content

Commit 8d8cfcf

Browse files
committed
Add code embed example files embedded in docs
1 parent 45be7c9 commit 8d8cfcf

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

docs/embed-files.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,19 @@ Sometimes you don't want to embed a whole file. Maybe because you need just a fe
6767
In your code file you need to surround the fragment between `/// [demo]` lines (before and after the fragment).
6868
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 ([\_media/example.js](_media/example.js ':ignore')):
70+
Example: The file [\_media/example.js](_media/example.js ':ignore') contains `/// [demo]` identifiers:
7171

72-
`[filename](_media/example.js ':include :type=code :fragment=demo')`
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+
```
7383

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

0 commit comments

Comments
 (0)