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.

Table 1: Settings for the !include command.

KeyDefaultDescription
styleThe style settings that are passed to rendered HTML tag.
endNoneString contained on the ending line.
startNoneString contained on the starting line.
re-flagsre.M|re.S|re.URegular expression flags commands pass to the Python re module.
idThe class settings to be passed to the rendered tag.
reNoneExtract content via a regex, if the 'content' group exists it is used as the desired content, otherwise group zero is used.
classThe 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.

Example 1: Example use of the !include command to import a complete file.

!include /include_example.md

This content exists within the "include_example.md" file. Is it.

Example 2: Example use of the !include command to import a portion of another file.

!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.