Include
Attention 💥
Support since v0.2.12.
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 book root directory.
Options
Option | Description | Required | Default |
---|---|---|---|
file | File to include, relative to book root 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, cloud be raw or codeblock | No | codeblock |
Attention 💥
- When
range
is used, it will insert the specified lines starts from 1.- The
raw
type will insert the raw file content into the markdown file directly, while thecodeblock
type will wrap it as a code block.
Example
{% embed include file="src/SUMMARY.md" %}
This will include the src/SUMMARY.md file and wrap it as a markdown code block which is the source code of this book’s summary.
# Summary
# Basics
- [Intro](index.md)
- [Usage](usage.md)
- [More Apps](more-apps.md)
- [Global Embedding](global-embedding.md)
- [Ignore Embeds](ignore-embeds.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)