Skip to main content
Module

x/charmd/renderer.ts>Extension

A simple, extendable markdown renderer for your terminal.
Latest
interface Extension
import { type Extension } from "https://deno.land/x/charmd@v0.1.2/renderer.ts";

Methods

optional
init(md: string, options: Options): string | void

Called before AST generation, if a string is returned, it will override the input markdown for later extension's init fn and processing steps

optional
postAST(astRoot: Node, options: Options): void

Called with the generated AST's root node, before any transformations

optional
transformNode(
transformerFn: (
node: Node,
parent: Node,
options: Options,
) => void
,
node: Node,
parent: Node | undefined,
options: Options,
): boolean | void

Called with each node

optional
postTransform(astRoot: Node, options: Options): void

Called after all the transformations ran for all nodes

optional
generateNode(
generatorFn: (
node: Node,
parent: Node,
options: Options,
) => string | undefined
,
node: Node,
parent: Node | undefined,
options: Options,
): string | void

Called with each node. It should return the string representation of the rendered node,if the extension handles that specific node, or void, if its not handled by the extension.

optional
postGenerate(rendered: string, options: Options): string

Called after the string representation is created.