Modal Extension

buildDeveloper Extension

This extension has no associated syntax for MooseDown files.

The Modal extension renders modal windows containing code content and generates the anchor elements to trigger them. The tokens may either include a string of content explicitly or the absolute path of a project file to read content from. These tokens spawn from other MooseDocs extensions. For example, an automatic link to a source file creates a modal displaying its complete content, as demonstrated in Example 1.

Example 1: Modal trigger generated by the AutoLink extension.

commentnote:The Modal extension is for code only

Currently, the Modal extension is strictly for displaying code content. An extension may still create modals that display other types of content by using the appropriate style classes. For example, the search button at the top of this page triggers a modal created by the Navigation extension.

Configuration

The Modal extension implements a procedure to prevent the display of file contents, which helps to ensure that sensitive or proprietary information is not accidentally revealed to the public, as multiple extensions create these tokens. For example, the !syntax inputs command from the Application Syntax extension generates a list of MOOSE input files. But toggling the hide_source option (see Table 1) disables the modal triggers leaving filenames rendered as plain text.

Table 1: Configuration options for the Modal extension.

KeyDefaultDescription
activeTrueToggle for disabling the extension. This only changes the initial active state, use setActive to control at runtime.
hide_sourceFalseDisable all modals containing source file content.
exceptions[]A list of shell-style patterns for displaying certain files when the 'hide_source' setting is True.

The options listed in Table 1 are set via the configuration file. The hide_source option prevents displaying all source files, not just, e.g., C++ files. Hence, the exceptions option provides a means for handpicking files deemed safe to reveal, and the configuration below demonstrates its use.

MooseDocs.extensions.modal:
    hide_source: True
    exceptions:
        - '*.C'
        - '*.h'
        - '*.yml'
        - '*.i'
        - '*tests'
(contrib/moose/python/MooseDocs/test/config.yml)