Postprocessor: Rendered Markdown Text Postprocessing#

Postprocessor holds per-node-type hooks that run over already-rendered text, escaping MyST syntax (roles, dollarmath, comments, targets, block breaks) that would otherwise be re-parsed as markup on a later pass. Hooks self-register into REGISTRY, which plugin exposes to mdformat as POSTPROCESSORS.

Rendered Markdown Text Postprocessing.

Postprocessor holds per-node-type hooks that run over already-rendered text, escaping MyST syntax (roles, dollarmath, comments, targets, block breaks) that would otherwise be re-parsed as markup on a later pass. Hooks self-register into REGISTRY, which plugin exposes to mdformat as POSTPROCESSORS.

class myform.Postprocessor.Postprocessor#

[STATIC] Postprocessor for already-rendered Mdformat nodes (i.e. MD -> MD).

static register(fn: Interface, name: str = '') → Interface#

Decorator to register a method as a postprocessor for a given node type.

static postprocess_paragraph(text: str, node: mdformat.renderer.RenderTreeNode, ctx: mdformat.renderer.RenderContext) → str#

Process any MyST-specific block syntax that is nonetheless marked as text.

Parameters:
  • text – Text content to process.

  • node – Current render tree node.

  • ctx – Current render context.

Returns:

A potentially modified version of the input text.

static postprocess_text(text: str, node: mdformat.renderer.RenderTreeNode, ctx: mdformat.renderer.RenderContext) → str#

Process any MyST-specific inline syntax that is nonetheless marked as text.

Parameters:
  • text – Text content to process.

  • node – Current render tree node.

  • ctx – Current render context.

Returns:

A potentially modified version of the input text.