FLM Features¶
FLM organizes its functionality into features — pluggable modules that define macros, environments, and specials. Features are the mechanism by which FLM provides (and lets you customize) the available markup.
FLM is a framework, not a fixed language. The macros and environments available in your documents depend entirely on which features are loaded. You can enable or disable any feature, configure its behavior, or write your own custom features.
How Features Work¶
Each feature is a Python class inheriting from
Feature. A feature:
Defines macros, environments, and/or specials via its
add_latex_context_definitions()method.May provide a
DocumentManagerfor per-document state (e.g., managing numbering or collecting footnotes).May provide a
RenderManagerfor per-render state.Can declare dependencies on other features.
Default Features¶
The following features are enabled by default when using the flm
command-line tool (via the built-in default_config.yaml).
Note
When using the Python API with standard_features(), some of these
features (notably theorems) default to disabled and must be explicitly
enabled. The command-line tool’s default configuration enables a broader set
of features than the standard_features() helper.
Feature |
Description |
Syntax Reference |
|---|---|---|
|
Text emphasis, bold, character escapes, paragraph breaks, non-breaking spaces. |
|
|
Hyperlinks: |
|
|
Verbatim and code typesetting: |
|
|
Mathematics: inline |
|
|
Sectioning commands: |
|
|
Lists: |
|
|
Cross-reference management: |
|
|
Endnotes and footnotes: |
|
|
Figures and tables: |
|
|
Graphics inclusion: |
|
|
Definition terms: |
|
|
Theorems, lemmas, proofs, and related environments. |
Opt-In Features¶
The following features are available but must be explicitly enabled in the configuration:
Feature |
Description |
Syntax Reference |
|---|---|---|
|
Custom substitution macros defined via configuration. |
|
|
Block quote environments with attribution. |
|
|
Table-like cell layout. |
|
|
Citations (via the |
|
|
Inline annotations and comments. |
|
|
Custom text formatting macros and semantic block environments. |
Enabling and Configuring Features¶
Features are configured in your flmconfig.yaml or in the document’s YAML
front matter. See Feature Configuration for the full details.
Enable a feature with default options:
flm:
features:
quote: {}
Disable a feature:
flm:
features:
theorems: false
Configure a feature with custom options:
flm:
features:
endnotes:
categories:
- category_name: footnote
counter_formatter: roman
heading_title: 'Footnotes'
endnote_command: 'footnote'
Using Features from Extension Packages¶
External features can be loaded by using their fully qualified Python module path as the feature name in the configuration:
flm:
features:
'my_extension_package.my_feature': {}
Or by importing the package’s default configuration with $import:
$import:
- pkg:my_extension_package
Writing Custom Features¶
You can write your own features by creating a Python class that inherits from
Feature. The key method to implement is
add_latex_context_definitions(), which returns a dictionary of macros,
environments, and specials to register.
See the FLM “Features” - Extensions API documentation and the source code of the
built-in features in the flm/feature/ directory for examples.