@unified-latex/unified-latex-util-argspec

v1.6.0
Tools parsing a LaTeX argument specification in the xparse format
pegjs latex parser prettier unified-latex unified

unified-latex-util-argspec

What is this?

Tools to deal with xparse argument signatures. (E.g., "o m" for optional followed by mandatory argument).

When should I use this?

If you are working on the internals of unified-latex.

Install

npm install @unified-latex/unified-latex-util-argspec

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.

Functions

parse(str)

Parse an xparse argument specification string to an AST. This function caches results. Don't mutate the returned AST!

function parse(str: String): ArgSpec.Node[];

Parameters

Param Type Description
str String * LaTeX string input

printRaw(node, root)

Print an xparse argument specification AST to a string.

function printRaw(
  node: string | ArgSpec.Node | (string | ArgSpec.Node)[],
  root: Boolean
): string;

Parameters

Param Type
node Omitted
root Boolean
npm i @unified-latex/[email protected]

Metadata

  • MIT
  • Whatever
  • Jason Siefken
  • released 1/17/2024

Downloads

Maintainers