@unified-latex/unified-latex-to-mdast
TypeScript icon, indicating that this package has built-in type declarations

1.7.1 • Public • Published

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;

Package Sidebar

Install

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

Weekly Downloads

13

Version

1.7.1

License

MIT

Unpacked Size

323 kB

Total Files

7

Last publish

Collaborators

  • siefkenj