@unified-latex/unified-latex-types
Advanced tools
Comparing version 1.2.2 to 1.3.0
import * as Ast from "./ast-types"; | ||
export type ArgumentParser = (nodes: Ast.Node[], startPos: number) => { | ||
args: Ast.Argument[]; | ||
nodesRemoved: number; | ||
}; | ||
export type EnvInfo = { | ||
@@ -34,2 +38,8 @@ renderInfo?: { | ||
namedArguments?: (string | null)[]; | ||
/** | ||
* Whether the body is tikz-environment like (e.g., a `tikzpicture` or `scope`, etc.) | ||
* | ||
* @type {boolean} | ||
*/ | ||
tikzEnvironment?: boolean; | ||
}; | ||
@@ -95,2 +105,8 @@ /** | ||
namedArguments?: (string | null)[]; | ||
/** | ||
* Whether the macro represents a tikz path command (e.g. `\draw (0,0) -- (1,1);`). | ||
* | ||
* @type {boolean} | ||
*/ | ||
tikzPathCommand?: boolean; | ||
}; | ||
@@ -110,2 +126,18 @@ /** | ||
escapeToken?: string; | ||
/** | ||
* Custom argument parser. If present, function overrides the default argument | ||
* parsing of `signature`. An array of nodes is passed as well as the position | ||
* of the first node **after** the macro. This function is expected to _mutate_ | ||
* the input array, removing any nodes that are part of the macro's argument. | ||
* | ||
* This function will only be called on a macro if it has no existing `args`. | ||
* | ||
* Note: for stability when printing/accessing a node's arguments, this function | ||
* should always return an argument array of the same length, regardless of | ||
* whether optional arguments are present. For example, if this function parses | ||
* a node with signature `o m`, it should ways return a length-two array of arguments. | ||
* A "blank" argument (one that does not show up during printing) can be created | ||
* with `args([], { openMark: "", closeMark: "" })`, using the `unified-latex-builder` package. | ||
*/ | ||
argumentParser?: ArgumentParser; | ||
}; | ||
@@ -112,0 +144,0 @@ export type EnvInfoRecord = Record<string, EnvInfo>; |
{ | ||
"name": "@unified-latex/unified-latex-types", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "type definitions for unified-latex", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -27,2 +27,11 @@ <!-- DO NOT MODIFY --> | ||
## `ArgumentParser` | ||
```typescript | ||
export type ArgumentParser = ( | ||
nodes: Ast.Node[], | ||
startPos: number | ||
) => { args: Ast.Argument[]; nodesRemoved: number }; | ||
``` | ||
## `Ast` | ||
@@ -69,2 +78,8 @@ | ||
namedArguments?: (string | null)[]; | ||
/** | ||
* Whether the body is tikz-environment like (e.g., a `tikzpicture` or `scope`, etc.) | ||
* | ||
* @type {boolean} | ||
*/ | ||
tikzEnvironment?: boolean; | ||
}; | ||
@@ -147,2 +162,8 @@ /** | ||
namedArguments?: (string | null)[]; | ||
/** | ||
* Whether the macro represents a tikz path command (e.g. `\draw (0,0) -- (1,1);`). | ||
* | ||
* @type {boolean} | ||
*/ | ||
tikzPathCommand?: boolean; | ||
}; | ||
@@ -162,2 +183,18 @@ /** | ||
escapeToken?: string; | ||
/** | ||
* Custom argument parser. If present, function overrides the default argument | ||
* parsing of `signature`. An array of nodes is passed as well as the position | ||
* of the first node **after** the macro. This function is expected to _mutate_ | ||
* the input array, removing any nodes that are part of the macro's argument. | ||
* | ||
* This function will only be called on a macro if it has no existing `args`. | ||
* | ||
* Note: for stability when printing/accessing a node's arguments, this function | ||
* should always return an argument array of the same length, regardless of | ||
* whether optional arguments are present. For example, if this function parses | ||
* a node with signature `o m`, it should ways return a length-two array of arguments. | ||
* A "blank" argument (one that does not show up during printing) can be created | ||
* with `args([], { openMark: "", closeMark: "" })`, using the `unified-latex-builder` package. | ||
*/ | ||
argumentParser?: ArgumentParser; | ||
}; | ||
@@ -164,0 +201,0 @@ ``` |
Sorry, the diff of this file is not supported yet
19543
246
222