Include
The include app is for including source file and wrapped it as markdown code block.
The language is automatically detected by the file name extension. You can override it by passing lang
option. The file path should be relative to the execution directory.
Options
Option | Description | Required | Default |
---|---|---|---|
file | File to include, relative to the exection directory | Yes | - - |
lang | This will override the automatically detected language | No | - - |
range | Range of lines to include, e.g. 1-10 or 1- or -10 | No | - - |
type | Include type, insert or embed | No | embed |
💥Attention
- When
range
is used, it will insert the specified lines.- The
insert
type will insert the file content into the markdown file directly, while theembed
type will wrap it as a code block.
Example
{% embed include file="docs/src/SUMMARY.md" %}
This will include the docs/src/SUMMARY.md file and wrap it as a code block which is the source code of this book’s summary.
# Summary
# Basics
- [Intro](index.md)
- [Usage](usage.md)
- [Global Embedding](global-embedding.md)
- [Ignore Embeds](ignore-embeds.md)
- [More Apps](more-apps.md)
# Apps
- [Third Party Apps](third-party/index.md)
- [Gist](third-party/gist.md)
- [Vimeo](third-party/vimeo.md)
- [Giscus](third-party/giscus.md)
- [Youtube](third-party/youtube.md)
- [Codepen](third-party/codepen.md)
- [Stackblitz](third-party/stackblitz.md)
- [Codesandbox](third-party/codesandbox.md)
- [Bilibili](third-party/bilibili.md)
- [Local Apps](local/index.md)
- [Footer](local/footer.md)
- [Include](local/include.md)
- [Scroll to Top](local/scroll-to-top.md)
- [Announcement Banner](local/announcement-banner.md)