# @unified-latex/unified-latex-to-mdast

> Convert a unified-latex AST to a MDAST AST (for Markdown conversion)

Latest version **1.8.4** (published 2026-04-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @unified-latex/unified-latex-to-mdast
pnpm add @unified-latex/unified-latex-to-mdast
yarn add @unified-latex/unified-latex-to-mdast
bun add @unified-latex/unified-latex-to-mdast
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.8.4 |
| Published | 2026-04-03 |
| First published | 2023-10-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 9 |
| Unpacked size | 361.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 127 |
| Author | Jason Siefken |
| Maintainers | siefkenj |
| Keywords | pegjs, latex, parser, prettier, unified-latex, unified |

## Links

- npm: https://www.npmjs.com/package/@unified-latex/unified-latex-to-mdast
- Repository: https://github.com/siefkenj/unified-latex
- Homepage: https://github.com/siefkenj/unified-latex#readme
- Issues: https://github.com/siefkenj/unified-latex/issues
- npm.io page: https://npm.io/package/@unified-latex/unified-latex-to-mdast

## Dependencies (9)

- [hast](https://npm.io/package/hast.md) ^1.0.0
- [unified](https://npm.io/package/unified.md) ^10.1.2
- [@types/mdast](https://npm.io/package/@types/mdast.md) ^4.0.1
- [rehype-remark](https://npm.io/package/rehype-remark.md) ^10.0.0
- [remark-stringify](https://npm.io/package/remark-stringify.md) ^10.0.3
- [hast-util-to-string](https://npm.io/package/hast-util-to-string.md) ^3.0.0
- [@unified-latex/unified-latex](https://npm.io/package/@unified-latex/unified-latex.md) ^1.8.4
- [@unified-latex/unified-latex-types](https://npm.io/package/@unified-latex/unified-latex-types.md) ^1.8.4
- [@unified-latex/unified-latex-to-hast](https://npm.io/package/@unified-latex/unified-latex-to-hast.md) ^1.8.4

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.8.4 (latest) — 2026-04-03
- 1.8.3 — 2025-06-16
- 1.8.2 — 2025-02-09
- 1.8.1 — 2024-10-21
- 1.8.0 — 2024-08-22
- 1.7.1 — 2024-03-19
- 1.7.0 — 2024-02-25
- 1.6.1 — 2024-02-18
- 1.6.0 — 2024-01-17
- 1.5.0 — 2023-10-02
- 1.4.2 — 2023-10-01

## README

<!-- DO NOT MODIFY -->
<!-- This file was autogenerated by build-docs.ts -->
<!-- Edit the docstring in index.ts and regenerate -->
<!-- rather than editing this file directly. -->
# 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

```bash
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

```typescript
PluginOptions
```

### Type

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

```typescript
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")

```typescript
function convertToMarkdown(
  tree: Ast.Node | Ast.Node[],
  options: PluginOptions
): string;
```

**Parameters**

| Param   | Type                     |
| :------ | :----------------------- |
| tree    | `Ast.Node \| Ast.Node[]` |
| options | `PluginOptions`          |

# Types

## `PluginOptions`

```typescript
export type PluginOptions = HtmlLikePluginOptions & RehypeRemarkOptions;
```

---
_Source: https://npm.io/package/@unified-latex/unified-latex-to-mdast · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
