Skip to content

Commit d0557d9

Browse files
committed
docs: add embed files, resolve #383, resolve #333, resolve #134
1 parent 53f9e58 commit d0557d9

File tree

9 files changed

+318
-79
lines changed

9 files changed

+318
-79
lines changed

docs/_media/example.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h1>To infinity and Beyond!</h1>

docs/_media/example.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
> This is from the `example.md`

docs/_sidebar.md

+25-21
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
- Getting started
2-
- [Quick start](quickstart.md)
3-
- [Writing more pages](more-pages.md)
4-
- [Custom navbar](custom-navbar.md)
5-
- [Cover page](cover.md)
1+
* Getting started
62

7-
- Customization
8-
- [Configuration](configuration.md)
9-
- [Themes](themes.md)
10-
- [List of Plugins](plugins.md)
11-
- [Write a Plugin](write-a-plugin.md)
12-
- [Markdown configuration](markdown.md)
13-
- [Language highlighting](language-highlight.md)
3+
* [Quick start](quickstart.md)
4+
* [Writing more pages](more-pages.md)
5+
* [Custom navbar](custom-navbar.md)
6+
* [Cover page](cover.md)
147

15-
- Guide
16-
- [Deploy](deploy.md)
17-
- [Helpers](helpers.md)
18-
- [Vue compatibility](vue.md)
19-
- [CDN](cdn.md)
20-
- [Offline Mode(PWA)](pwa.md)
21-
- [Server-client renderer(SSR)](ssr.md)
8+
* Customization
229

23-
- [Awesome docsify](awesome.md)
24-
- [Changelog](changelog.md)
10+
* [Configuration](configuration.md)
11+
* [Themes](themes.md)
12+
* [List of Plugins](plugins.md)
13+
* [Write a Plugin](write-a-plugin.md)
14+
* [Markdown configuration](markdown.md)
15+
* [Language highlighting](language-highlight.md)
16+
17+
* Guide
18+
19+
* [Deploy](deploy.md)
20+
* [Helpers](helpers.md)
21+
* [Vue compatibility](vue.md)
22+
* [CDN](cdn.md)
23+
* [Offline Mode(PWA)](pwa.md)
24+
* [Server-client renderer(SSR)](ssr.md)
25+
* [Embed Files <sup style="color:red">(new)<sup>](embed-files)
26+
27+
* [Awesome docsify](awesome.md)
28+
* [Changelog](changelog.md)

docs/de-de/_sidebar.md

+25-21
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
- Loslegen
2-
- [Schnellstart](de-de/quickstart.md)
3-
- [Schreiben weiterer Seiten](de-de/more-pages.md)
4-
- [Navigationsleiste anpassen](de-de/custom-navbar.md)
5-
- [Titelseite](de-de/cover.md)
1+
* Loslegen
62

7-
- Anpassen
8-
- [Einstellungen](de-de/configuration.md)
9-
- [Themen](de-de/themes.md)
10-
- [Liste der Erweiterungen](de-de/plugins.md)
11-
- [Schreiben eigener Erweiterungen](de-de/write-a-plugin.md)
12-
- [Markdown-Einstellungen](de-de/markdown.md)
13-
- [Hervorheben von Sprachen](de-de/language-highlight.md)
3+
* [Schnellstart](de-de/quickstart.md)
4+
* [Schreiben weiterer Seiten](de-de/more-pages.md)
5+
* [Navigationsleiste anpassen](de-de/custom-navbar.md)
6+
* [Titelseite](de-de/cover.md)
147

15-
- Guide
16-
- [Inbetriebnahme](de-de/deploy.md)
17-
- [Helfer](de-de/helpers.md)
18-
- [Vue Kompatibilität](de-de/vue.md)
19-
- [CDN](de-de/cdn.md)
20-
- [Offline Modus (PWA)](de-de/pwa.md)
21-
- [Server-client renderer (SSR)](de-de/ssr.md)
8+
* Anpassen
229

23-
- [Awesome docsify](de-de/awesome.md)
24-
- [Changelog](de-de/changelog.md)
10+
* [Einstellungen](de-de/configuration.md)
11+
* [Themen](de-de/themes.md)
12+
* [Liste der Erweiterungen](de-de/plugins.md)
13+
* [Schreiben eigener Erweiterungen](de-de/write-a-plugin.md)
14+
* [Markdown-Einstellungen](de-de/markdown.md)
15+
* [Hervorheben von Sprachen](de-de/language-highlight.md)
16+
17+
* Guide
18+
19+
* [Inbetriebnahme](de-de/deploy.md)
20+
* [Helfer](de-de/helpers.md)
21+
* [Vue Kompatibilität](de-de/vue.md)
22+
* [CDN](de-de/cdn.md)
23+
* [Offline Modus (PWA)](de-de/pwa.md)
24+
* [Server-client renderer (SSR)](de-de/ssr.md)
25+
* [Embed Files <sup style="color:red">(new)<sup>](de-de/embed-files)
26+
27+
* [Awesome docsify](de-de/awesome.md)
28+
* [Changelog](de-de/changelog.md)

docs/de-de/embed-files.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Embed files
2+
3+
With docsify 4.6 it is now possible to embed any type of file.
4+
You can embed these files as video, audio, iframes, or code blocks, and even Markdown files can even be embedded directly into the document.
5+
6+
For example, here embedded a Markdown file. You only need to do this:
7+
8+
```markdown
9+
[filename](_media/example.md ':include')
10+
```
11+
12+
Then the content of `example.md` will be displayed directly here
13+
14+
[filename](_media/example.md ':include')
15+
16+
You can check the original content for [example.md](_media/example.md ':ignore').
17+
18+
Normally, this will compiled into a link, but in docsify, if you add `:include` it will be embedded.
19+
20+
## Embedded file type
21+
22+
Currently, file extension are automatically recognized and embedded in different ways.
23+
24+
This is a supported embedding type:
25+
26+
* **iframe** `.html`, `.html`
27+
* **markdown** `.markdown`, `.md`
28+
* **audio** `.mp3`
29+
* **video** `.mp4`, `.ogg`
30+
* **code** other file extension
31+
32+
Of course, you can force the specified. For example, you want to Markdown file as code block embedded.
33+
34+
```markdown
35+
[filename](_media/example.md ':include :type=code')
36+
```
37+
38+
You will get it
39+
40+
[filename](_media/example.md ':include :type=code')
41+
42+
## Tag attribute
43+
44+
If you embed the file as `iframe`, `audio` and `video`, then you may need to set the attributes of these tags.
45+
46+
```markdown
47+
[cinwell website](https://cinwell.com ':include :type=iframe width=100% height=400px')
48+
```
49+
50+
[cinwell website](https://cinwell.com ':include :type=iframe width=100% height=400px')
51+
52+
Did you see it? You only need to write directly. You can check [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) for these attributes.
53+
54+
## The code block highlight
55+
56+
Embedding any type of source code file, you can specify the highlighted language or automatically identify.
57+
58+
```markdown
59+
[](_media/example.html ':include :type=code')
60+
```
61+
62+
⬇️
63+
64+
[](_media/example.html ':include :type=code')
65+
66+
Or Specify the language
67+
68+
```markdown
69+
[](_media/example.html ':include :type=code text')
70+
```
71+
72+
⬇️
73+
74+
[](_media/example.html ':include :type=code text')
75+
76+
?> How to set highlight? You can see [here](language-highlight.md).

docs/embed-files.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Embed files
2+
3+
With docsify 4.6 it is now possible to embed any type of file.
4+
You can embed these files as video, audio, iframes, or code blocks, and even Markdown files can even be embedded directly into the document.
5+
6+
For example, here embedded a Markdown file. You only need to do this:
7+
8+
```markdown
9+
[filename](_media/example.md ':include')
10+
```
11+
12+
Then the content of `example.md` will be displayed directly here
13+
14+
[filename](_media/example.md ':include')
15+
16+
You can check the original content for [example.md](_media/example.md ':ignore').
17+
18+
Normally, this will compiled into a link, but in docsify, if you add `:include` it will be embedded.
19+
20+
## Embedded file type
21+
22+
Currently, file extension are automatically recognized and embedded in different ways.
23+
24+
This is a supported embedding type:
25+
26+
* **iframe** `.html`, `.html`
27+
* **markdown** `.markdown`, `.md`
28+
* **audio** `.mp3`
29+
* **video** `.mp4`, `.ogg`
30+
* **code** other file extension
31+
32+
Of course, you can force the specified. For example, you want to Markdown file as code block embedded.
33+
34+
```markdown
35+
[filename](_media/example.md ':include :type=code')
36+
```
37+
38+
You will get it
39+
40+
[filename](_media/example.md ':include :type=code')
41+
42+
## Tag attribute
43+
44+
If you embed the file as `iframe`, `audio` and `video`, then you may need to set the attributes of these tags.
45+
46+
```markdown
47+
[cinwell website](https://cinwell.com ':include :type=iframe width=100% height=400px')
48+
```
49+
50+
[cinwell website](https://cinwell.com ':include :type=iframe width=100% height=400px')
51+
52+
Did you see it? You only need to write directly. You can check [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) for these attributes.
53+
54+
## The code block highlight
55+
56+
Embedding any type of source code file, you can specify the highlighted language or automatically identify.
57+
58+
```markdown
59+
[](_media/example.html ':include :type=code')
60+
```
61+
62+
⬇️
63+
64+
[](_media/example.html ':include :type=code')
65+
66+
Or Specify the language
67+
68+
```markdown
69+
[](_media/example.html ':include :type=code text')
70+
```
71+
72+
⬇️
73+
74+
[](_media/example.html ':include :type=code text')
75+
76+
?> How to set highlight? You can see [here](language-highlight.md).

docs/zh-cn/_sidebar.md

+25-21
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
- 入门
2-
- [快速开始](zh-cn/quickstart.md)
3-
- [多页文档](zh-cn/more-pages.md)
4-
- [定制导航栏](zh-cn/custom-navbar.md)
5-
- [封面](zh-cn/cover.md)
1+
* 入门
62

7-
- 定制化
8-
- [配置项](zh-cn/configuration.md)
9-
- [主题](zh-cn/themes.md)
10-
- [插件列表](zh-cn/plugins.md)
11-
- [开发插件](zh-cn/write-a-plugin.md)
12-
- [Markdown 配置](zh-cn/markdown.md)
13-
- [代码高亮](zh-cn/language-highlight.md)
3+
* [快速开始](zh-cn/quickstart.md)
4+
* [多页文档](zh-cn/more-pages.md)
5+
* [定制导航栏](zh-cn/custom-navbar.md)
6+
* [封面](zh-cn/cover.md)
147

15-
- 指南
16-
- [部署](zh-cn/deploy.md)
17-
- [文档助手](zh-cn/helpers.md)
18-
- [兼容 Vue](zh-cn/vue.md)
19-
- [CDN](zh-cn/cdn.md)
20-
- [离线模式(PWA)](zh-cn/pwa.md)
21-
- [服务端渲染 (SSR)](zh-cn/ssr.md)
8+
* 定制化
229

23-
- [Awesome docsify](zh-cn/awesome.md)
24-
- [Changelog](zh-cn/changelog.md)
10+
* [配置项](zh-cn/configuration.md)
11+
* [主题](zh-cn/themes.md)
12+
* [插件列表](zh-cn/plugins.md)
13+
* [开发插件](zh-cn/write-a-plugin.md)
14+
* [Markdown 配置](zh-cn/markdown.md)
15+
* [代码高亮](zh-cn/language-highlight.md)
16+
17+
* 指南
18+
19+
* [部署](zh-cn/deploy.md)
20+
* [文档助手](zh-cn/helpers.md)
21+
* [兼容 Vue](zh-cn/vue.md)
22+
* [CDN](zh-cn/cdn.md)
23+
* [离线模式(PWA)](zh-cn/pwa.md)
24+
* [服务端渲染 (SSR)](zh-cn/ssr.md)
25+
* [文件嵌入<sup style="color:red">(new)<sup>](zh-cn/embed-files)
26+
27+
* [Awesome docsify](zh-cn/awesome.md)
28+
* [Changelog](zh-cn/changelog.md)

docs/zh-cn/embed-files.md

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# 文件嵌入
2+
3+
docsify 4.6 开始支持嵌入任何类型的文件到文档里。你可以将文件当成 `iframe``video``audio` 或者 `code block`,如果是 Markdown 文件,甚至可以直接插入到当前文档里。
4+
5+
这是一个嵌入 Markdown 文件的例子。
6+
7+
```markdown
8+
[filename](_media/example.md ':include')
9+
```
10+
11+
`example.md` 文件的内容将会直接显示在这里
12+
13+
[filename](_media/example.md ':include')
14+
15+
你可以查看 [example.md](_media/example.md ':ignore') 原始内容对比效果。
16+
17+
通常情况下,这样的语法将会被当作链接处理。但是在 docsify 里,如果你添加一个 `:include` 选项,它就会被当作文件嵌入。
18+
19+
## 嵌入的类型
20+
21+
当前,嵌入的类型是通过文件后缀自动识别的,这是目前支持的类型:
22+
23+
* **iframe** `.html`, `.html`
24+
* **markdown** `.markdown`, `.md`
25+
* **audio** `.mp3`
26+
* **video** `.mp4`, `.ogg`
27+
* **code** other file extension
28+
29+
当然,你也可以强制设置嵌入类型。例如你想将 Markdown 文件当作一个 `code block` 嵌入。
30+
31+
```markdown
32+
[filename](_media/example.md ':include :type=code')
33+
```
34+
35+
你将得到
36+
37+
[filename](_media/example.md ':include :type=code')
38+
39+
## 标签属性
40+
41+
如果你嵌入文件是一个 `iframe``audio` 或者 `video`,你可以给这些标签设置属性。
42+
43+
```markdown
44+
[cinwell website](https://cinwell.com ':include :type=iframe width=100% height=400px')
45+
```
46+
47+
[cinwell website](https://cinwell.com ':include :type=iframe width=100% height=400px')
48+
49+
看见没?你只需要直接写属性就好了,每个标签有哪些属性建议你查看 [MDN 文档](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe)
50+
51+
## 代码块高亮
52+
53+
如果是嵌入一个代码块,你可以设置高亮的语言,或者让它自动识别。
54+
55+
```markdown
56+
[](_media/example.html ':include :type=code')
57+
```
58+
59+
⬇️
60+
61+
[](_media/example.html ':include :type=code')
62+
63+
这里是手动设置高亮语言
64+
65+
```markdown
66+
[](_media/example.html ':include :type=code text')
67+
```
68+
69+
⬇️
70+
71+
[](_media/example.html ':include :type=code text')
72+
73+
?> 如何高亮代码?你可以查看[这份文档](language-highlight.md).

0 commit comments

Comments
 (0)