Include
Attention 💥
Support since v0.2.12.
Language is detected by file extension, which I manually referred, simplified and extended from linguist.
You can customize language detection rules in your
book.toml. See Language Matching for details.If you find any issues with the language detection, please open an issue. Currenltly language map is under languages.yaml.
The include app is for including source file and wrapping 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 | - - |
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)
- [Ignore Embeds](ignore-embeds.md)
- [Global Embedding](global-embedding.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)
# Development
- [Development Guide](development/index.md)
- [Testing Guide](development/testing.md)
- [Template System](development/template.md)
- [Language Matching](development/language-matching.md)
# CHANGELOG
- [CHANGELOG](CHANGELOG.md)