Include Extension
A primary driver behind developing the MooseDocs system was to create a single source for all documentation and allow the same piece of text to be reused in multiple locations and in multiple formats. Therefore, it is possible to include markdown within markdown using the !include
command. The available setting for the !include
command is given in Table 1.
Key | Default | Description |
---|---|---|
style | The style settings that are passed to rendered HTML tag. | |
end | None | String contained on the ending line. |
start | None | String contained on the starting line. |
re-flags | re.M|re.S|re.U | Regular expression flags commands pass to the Python re module. |
id | The class settings to be passed to the rendered tag. | |
re | None | Extract content via a regex, if the 'content' group exists it is used as the desired content, otherwise group zero is used. |
class | The class settings to be passed to rendered HTML tag. |
Example 1 uses the include command to import the complete content of another file and Example 2 imports a portion of a file using the "re" setting.
!include /include_example.md
This content exists within the "include_example.md" file. Is it.
!include /core.md re=(?P<content>^The core.*?)^Syntax
The core extension is the portion of the MooseDocs language that is designed to mimic markdown syntax. MooseDown is far more strict than traditional markdown implementations. Therefore, the following sections should be read in detail to understand the supported syntax, especially if you are familiar with more general markdown formats.