Module @unified-latex/unified-latex-to-mdast - v1.6.0

unified-latex-to-mdast

What is this?

Functions to convert unified-latex Abstract Syntax Tree (AST) to a MDAST (Markdown-like) tree.

When should I use this?

If you want to convert LaTeX to Markdown.

Install

npm install @unified-latex/unified-latex-to-mdast

This package contains both esm and commonjs exports. To explicitly access the esm export, import the .js file. To explicitly access the commonjs export, import the .cjs file.

Plugins

unifiedLatexToMdast

Unified plugin to convert a unified-latex AST into a mdast AST.

Usage

unified().use(unifiedLatexToMdast[, options])

options

PluginOptions

Type

Plugin<PluginOptions[], Ast.Root, Mdast.Root>

function unifiedLatexToMdast(
options: PluginOptions
): (tree: Ast.Root, file: VFile) => Mdast.Root;

Functions

convertToMarkdown(tree, options)

Convert the unified-latex AST tree into a Markdown string. If you need more precise control or further processing, consider using unified directly with the unifiedLatexToMdast plugin.

For example,

unified()
.use(unifiedLatexFromString)
.use(unifiedLatexToMdast)
.use(remarkStringify)
.processSync("\\LaTeX to convert")
function convertToMarkdown(
tree: Ast.Node | Ast.Node[],
options: PluginOptions
): string;

Parameters

Param Type
tree Ast.Node | Ast.Node[]
options PluginOptions

Types

PluginOptions

export type PluginOptions = HtmlLikePluginOptions & RehypeRemarkOptions;

Index

Type Aliases

Functions

Generated using TypeDoc