<!-- 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-util-pgfkeys

## What is this?

Functions to help manipulate `unified-latex` Abstract Syntax Tree (AST) that contain
pgfkeys-style arguments. Note that pgfkeys aren't built into `Ast.Ast`. Instead, parsing
nodes as pgfkeys will produce a new (incompatible) AST.

## When should I use this?

If you want to parse or manipulate macros/environments with pgfkeys-style arguments.

## Install

```bash
npm install @unified-latex/unified-latex-util-pgfkeys
```

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

## `createMatchers()`



```typescript
function createMatchers(): { isChar: (node: Ast.Node, char: string) => node is Ast.String; isComma: (node: Ast.Node) => node is Ast.String; isEquals: (node: Ast.Node) => node is Ast.String; isWhitespace: (node: Ast.Node) => node is Ast.Whitespace; isParbreak: (node: Ast.Node) => node is Ast.Parbreak; isSameLineComment: (node: Ast.Node) => boo...
```

## `parsePgfkeys(ast, options)`

Parse the arguments of a Pgfkeys macro. The `ast`
is expected to be a comma separated list of `Item`s.
Each item can have 0 or more item parts, which are separated
by "=". If `itemPart` is undefined,

If `options.allowParenGroups === true`, then commas that occur inside groups of parenthesis
will not be parsed as separators. This is useful for parsing tikz `\foreach` loops.

```typescript
function parsePgfkeys(
  ast: Ast.Node[],
  options: { allowParenGroups: boolean }
): Item[];
```

**Parameters**

| Param   | Type                              |
| :------ | :-------------------------------- |
| ast     | `Ast.Node[]`                      |
| options | <span color='gray'>Omitted</span> |

## `pgfkeysArgToObject(arg)`

Parse `arg` as pgfkeys and return a JavaScript object with the results.
The keys will be normalized to strings and the values will be arrays of nodes.

```typescript
function pgfkeysArgToObject(
  arg: Ast.Node[] | Ast.Argument
): Record<string, Ast.Node[]>;
```

**Parameters**

| Param | Type                         |
| :---- | :--------------------------- |
| arg   | `Ast.Node[] \| Ast.Argument` |

# Types

## `Item`

```typescript
export type Item = {
    itemParts?: Ast.Node[][];
    trailingComment: Ast.Comment | null;
    trailingComma?: boolean;
    leadingParbreak?: boolean;
};
```
