myst_parser.config.main
#
The configuration for the myst parser.
1. Module Contents#
1.1. Classes#
Type of the external schemes dictionary. |
|
Configuration options for the Markdown Parser. |
1.2. Functions#
Check that the extensions are a list of known strings |
|
Check that the external schemes are of the right format. |
|
Check that the sub_delimiters are a tuple of length 2 of strings of length 1 |
|
Check that the inventories are a dict of {str: (str, Optional[str])} |
|
Check that the heading_slug_func is a callable. |
|
Check that the extensions are a sequence of known strings |
|
Merge the file-level topmatter with the global config. |
|
Read the (optional) YAML topmatter from a source string. |
1.3. API#
- myst_parser.config.main.check_extensions(inst: MdParserConfig, field: dataclasses.Field, value: Any) None [source]#
Check that the extensions are a list of known strings
- class myst_parser.config.main.UrlSchemeType[source]#
Bases:
typing.TypedDict
Type of the external schemes dictionary.
Initialization
Initialize self. See help(type(self)) for accurate signature.
- myst_parser.config.main.check_url_schemes(inst: MdParserConfig, field: dataclasses.Field, value: Any) None [source]#
Check that the external schemes are of the right format.
- myst_parser.config.main.check_sub_delimiters(_: MdParserConfig, field: dataclasses.Field, value: Any) None [source]#
Check that the sub_delimiters are a tuple of length 2 of strings of length 1
- myst_parser.config.main.check_inventories(_: MdParserConfig, field: dataclasses.Field, value: Any) None [source]#
Check that the inventories are a dict of {str: (str, Optional[str])}
- myst_parser.config.main.check_heading_slug_func(inst: MdParserConfig, field: dataclasses.Field, value: Any) None [source]#
Check that the heading_slug_func is a callable.
- myst_parser.config.main.check_fence_as_directive(inst: MdParserConfig, field: dataclasses.Field, value: Any) None [source]#
Check that the extensions are a sequence of known strings
- class myst_parser.config.main.MdParserConfig[source]#
Configuration options for the Markdown Parser.
Note in the sphinx configuration these option names are prepended with
myst_
- disable_syntax: collections.abc.Iterable[str] = 'field(...)'#
- url_schemes: dict[str, myst_parser.config.main.UrlSchemeType | None] = 'field(...)'#
- ref_domains: collections.abc.Iterable[str] | None = 'field(...)'#
- number_code_blocks: collections.abc.Sequence[str] = 'field(...)'#
- heading_slug_func: collections.abc.Callable[[str], str] | None = 'field(...)'#
- suppress_warnings: collections.abc.Sequence[str] = 'field(...)'#
- copy(**kwargs: Any) myst_parser.config.main.MdParserConfig [source]#
Return a new object replacing specified fields with new values.
Note: initiating the copy will also validate the new fields.
- classmethod get_fields() tuple[dataclasses.Field, ...] [source]#
Return all attribute fields in this class.
- as_triple() collections.abc.Iterable[tuple[str, Any, dataclasses.Field]] [source]#
Yield triples of (name, value, field).
- myst_parser.config.main.merge_file_level(config: myst_parser.config.main.MdParserConfig, topmatter: dict[str, Any], warning: collections.abc.Callable[[myst_parser.warnings_.MystWarnings, str], None]) myst_parser.config.main.MdParserConfig [source]#
Merge the file-level topmatter with the global config.
- Parameters:
config – Global config.
topmatter – Topmatter from the file.
warning – Function to call with a warning (type, message).
- Returns:
A new config object
- exception myst_parser.config.main.TopmatterReadError[source]#
Bases:
Exception
Topmatter parsing error.
Initialization
Initialize self. See help(type(self)) for accurate signature.
- myst_parser.config.main.read_topmatter(text: str | collections.abc.Iterator[str]) dict[str, Any] | None [source]#
Read the (optional) YAML topmatter from a source string.
This is identified by the first line starting with —, then read up to a terminating line of —, or ….
- Parameters:
source – The source string to read from
- Returns:
The topmatter