|
| 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). |
0 commit comments