myst_catalog: Portable metadata for MyST editing#

See the maintainer guide for extension selection and provenance.

Portable metadata for MyST editing.

See the [maintainer guide](../myst-catalog.md) for extension selection and provenance.

class myform.myst_catalog.ArgumentSpec(required: int = 0, optional: int = 0, final_whitespace: bool = False)#

Counts and splitting rules for text after the directive name.

class myform.myst_catalog.Catalog(directives: Mapping[str, DirectiveSpec], roles: Mapping[str, RoleSpec], extensions: frozenset[str])#

A read-only view of MyST metadata for a workspace.

The mappings list entries for name suggestions. Individual lookups also resolve known syntax from unlisted extensions so a caller can offer an extension hint.

directive(name: str) → DirectiveSpec | None#

Look up a known directive by its case-insensitive source name.

role(name: str) → RoleSpec | None#

Look up a known role by its case-insensitive source name.

is_raw_directive(name: str) → bool#

Whether the name has a known body grammar other than Markdown.

available_options(name: str, used: Iterable[str] = ()) → tuple[OptionSpec, ...]#

Return unset options, with required options first and ties ordered by name.

class myform.myst_catalog.DirectiveSpec(name: str, summary: str, extension: str, raw_body: bool = False, arguments: ArgumentSpec = ArgumentSpec(required=0, optional=0, final_whitespace=False), options: tuple[OptionSpec, ...] = ())#

Metadata for one source spelling of a directive.

available_options(used: Iterable[str] = ()) → tuple[OptionSpec, ...]#

Return unset options, with required options first and ties ordered by name.

class myform.myst_catalog.OptionSpec(name: str, summary: str = '', values: tuple[str, ...] = (), required: bool = False)#

An option key, with finite choices and required presence where applicable.

class myform.myst_catalog.RoleSpec(name: str, summary: str, extension: str)#

Metadata for one source spelling of an interpreted text role.

myform.myst_catalog.load_catalog(extensions: Iterable[str] = ()) → Catalog#

Load the built-in catalog plus supported extension names declared by the caller.

Pass extension IDs such as 'sphinx.ext.autodoc' from workspace settings. Unknown entries are ignored. Extension names are treated as data.