From 0aabe43eb776974cd9368ce2c5f432983c7cd092 Mon Sep 17 00:00:00 2001 From: Jason Siefken Date: Tue, 20 Aug 2024 11:51:43 -0400 Subject: [PATCH] Rebuild documentation --- packages/unified-latex-ctan/README.md | 8 ++-- packages/unified-latex-lint/README.md | 2 +- packages/unified-latex-to-pretext/README.md | 48 ++++--------------- packages/unified-latex-util-align/README.md | 2 +- .../unified-latex-util-arguments/README.md | 6 +-- .../unified-latex-util-environments/README.md | 6 +-- packages/unified-latex-util-macros/README.md | 2 +- packages/unified-latex-util-match/README.md | 6 +-- packages/unified-latex-util-parse/README.md | 16 +++---- packages/unified-latex-util-pgfkeys/README.md | 10 +--- packages/unified-latex-util-scan/README.md | 2 +- 11 files changed, 36 insertions(+), 72 deletions(-) diff --git a/packages/unified-latex-ctan/README.md b/packages/unified-latex-ctan/README.md index fe317bc2..52734d5c 100644 --- a/packages/unified-latex-ctan/README.md +++ b/packages/unified-latex-ctan/README.md @@ -40,7 +40,7 @@ import the `.js` file. To explicitly access the commonjs export, import the `.cj # Constants -| Name | Type | Description | -| :---------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------- | -| `environmentInfo` | `{ cleveref: EnvInfoRecord; exam: EnvInfoRecord; geometry: EnvInfoRecord; hyperref: EnvInfoRecord; latex2e: EnvInfoRecord; ... 10 more ...; multicol: EnvInfoRecord; }` | Info about the environments for available ctan packages. `latex2e` contains the standard environments for LaTeX. | -| `macroInfo` | `{ cleveref: MacroInfoRecord; exam: MacroInfoRecord; geometry: MacroInfoRecord; hyperref: MacroInfoRecord; latex2e: MacroInfoRecord; ... 10 more ...; multicol: MacroInfoRecord; }` | Info about the macros for available ctan packages. `latex2e` contains the standard macros for LaTeX. | +| Name | Type | Description | +| :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------- | +| `environmentInfo` | `{ amsart: EnvInfoRecord; cleveref: EnvInfoRecord; exam: EnvInfoRecord; geometry: EnvInfoRecord; hyperref: EnvInfoRecord; ... 11 more ...; multicol: EnvInfoRecord; }` | Info about the environments for available ctan packages. `latex2e` contains the standard environments for LaTeX. | +| `macroInfo` | `{ amsart: MacroInfoRecord; cleveref: MacroInfoRecord; exam: MacroInfoRecord; geometry: MacroInfoRecord; hyperref: MacroInfoRecord; ... 11 more ...; multicol: MacroInfoRecord; }` | Info about the macros for available ctan packages. `latex2e` contains the standard macros for LaTeX. | diff --git a/packages/unified-latex-lint/README.md b/packages/unified-latex-lint/README.md index 8020bc74..68cec17a 100644 --- a/packages/unified-latex-lint/README.md +++ b/packages/unified-latex-lint/README.md @@ -26,4 +26,4 @@ import the `.js` file. To explicitly access the commonjs export, import the `.cj | Name | Type | Description | | :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------ | -| `lints` | `{ unifiedLatexLintArgumentColorCommands: Plugin; ... 7 more ...; unifiedLatexLintPreferSetlength: Plugin<...>; }` | Object exporting all available lints. | +| `lints` | `{ unifiedLatexLintArgumentColorCommands: Plugin; ... 7 more ...; unifiedLatexLintPreferSetlength: Plugin<...>; }` | Object exporting all available lints. | diff --git a/packages/unified-latex-to-pretext/README.md b/packages/unified-latex-to-pretext/README.md index 9df0ef19..387e91e0 100644 --- a/packages/unified-latex-to-pretext/README.md +++ b/packages/unified-latex-to-pretext/README.md @@ -81,36 +81,19 @@ Unified plugin to convert a `unified-latex` AST into a `xast` AST representation #### options ```typescript -HtmlLikePluginOptions +PluginOptions ``` ### Type -`Plugin` +`Plugin` ```typescript function unifiedLatexToPretext( - options: HtmlLikePluginOptions + options: PluginOptions ): (tree: Ast.Root, file: VFile) => Xast.Root; ``` -where - -```typescript -type HtmlLikePluginOptions = { - /** - * Functions called to replace environments during processing. Key values should match environment names. - * You probably want to use the function `htmlLike(...)` to return a node that gets converted to specific HTML. - */ - environmentReplacements?: EnvironmentReplacements; - /** - * Functions called to replace macros during processing. Key values should match macro names. - * You probably want to use the function `htmlLike(...)` to return a node that gets converted to specific HTML. - */ - macroReplacements?: MacroReplacements; -}; -``` - ## `unifiedLatexWrapPars` Unified plugin to wrap paragraphs in `\html-tag:p{...}` macros. @@ -196,23 +179,6 @@ function convertToPretext( | tree | `Ast.Node \| Ast.Node[]` | | options | `PluginOptions` | -where - -```typescript -type PluginOptions = { - /** - * Functions called to replace environments during processing. Key values should match environment names. - * You probably want to use the function `htmlLike(...)` to return a node that gets converted to specific HTML. - */ - environmentReplacements?: EnvironmentReplacements; - /** - * Functions called to replace macros during processing. Key values should match macro names. - * You probably want to use the function `htmlLike(...)` to return a node that gets converted to specific HTML. - */ - macroReplacements?: MacroReplacements; -}; -``` - ## `wrapPars(nodes, options)` Wrap paragraphs in `

...

` tags. @@ -253,5 +219,11 @@ function wrapPars( ## `PluginOptions` ```typescript -export type PluginOptions = HtmlLikePluginOptions & {}; +export type PluginOptions = HtmlLikePluginOptions & { + /** + * A boolean where if it's true then the output won't be wrapped in the
... etc. tags. + * If it's false (default), a valid and complete PreTeXt document is returned. + */ + producePretextFragment?: boolean; +}; ``` diff --git a/packages/unified-latex-util-align/README.md b/packages/unified-latex-util-align/README.md index 9c737893..989844ba 100644 --- a/packages/unified-latex-util-align/README.md +++ b/packages/unified-latex-util-align/README.md @@ -35,7 +35,7 @@ function createMatchers( ): { isRowSep: Ast.TypeGuard; isColSep: (node: Ast.Node) => boolean; - isWhitespace: (node: Ast.Node) => boolean; + isWhitespace: (node: Ast.Node) => node is Ast.Whitespace; isSameLineComment: (node: Ast.Node) => boolean; isOwnLineComment: (node: Ast.Node) => boolean; }; diff --git a/packages/unified-latex-util-arguments/README.md b/packages/unified-latex-util-arguments/README.md index 11764d9f..30a9757d 100644 --- a/packages/unified-latex-util-arguments/README.md +++ b/packages/unified-latex-util-arguments/README.md @@ -43,16 +43,16 @@ option. #### options ```typescript -{ macros: Ast.MacroInfoRecord; } +{ macros: MacroInfoRecord; } ``` ### Type -`Plugin<{ macros: Ast.MacroInfoRecord; }[], Ast.Root, Ast.Root>` +`Plugin<{ macros: MacroInfoRecord; }[], Ast.Root, Ast.Root>` ```typescript function unifiedLatexAttachMacroArguments(options: { - macros: Ast.MacroInfoRecord; + macros: MacroInfoRecord; }): (tree: Ast.Root) => void; ``` diff --git a/packages/unified-latex-util-environments/README.md b/packages/unified-latex-util-environments/README.md index 1fbbbfcc..1fc6eadc 100644 --- a/packages/unified-latex-util-environments/README.md +++ b/packages/unified-latex-util-environments/README.md @@ -35,16 +35,16 @@ Unified plugin to process environment content and attach arguments. #### options ```typescript -{ environments: Ast.EnvInfoRecord; } +{ environments: EnvInfoRecord; } ``` ### Type -`Plugin<{ environments: Ast.EnvInfoRecord; }[], Ast.Root, Ast.Root>` +`Plugin<{ environments: EnvInfoRecord; }[], Ast.Root, Ast.Root>` ```typescript function unifiedLatexProcessEnvironments(options: { - environments: Ast.EnvInfoRecord; + environments: EnvInfoRecord; }): (tree: Ast.Root) => void; ``` diff --git a/packages/unified-latex-util-macros/README.md b/packages/unified-latex-util-macros/README.md index b397bf78..e95df135 100644 --- a/packages/unified-latex-util-macros/README.md +++ b/packages/unified-latex-util-macros/README.md @@ -47,7 +47,7 @@ function createMacroExpander( ```typescript function createMatchers(): { - isHash: (node: Ast.Node) => boolean; + isHash: (node: Ast.Node) => node is Ast.String; isNumber: (node: Ast.Node) => boolean; splitNumber: ( node: Ast.String diff --git a/packages/unified-latex-util-match/README.md b/packages/unified-latex-util-match/README.md index 4e88f214..df4a4260 100644 --- a/packages/unified-latex-util-match/README.md +++ b/packages/unified-latex-util-match/README.md @@ -23,6 +23,6 @@ import the `.js` file. To explicitly access the commonjs export, import the `.cj # Constants -| Name | Type | Description | -| :------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------- | -| `match` | `{ macro(node: any, macroName?: string): node is Ast.Macro; anyMacro(node: any): node is Ast.Macro; environment(node: any, envName?: string): node is Ast.Environment; anyEnvironment(node: any): node is Ast.Environment; ... 11 more ...; createEnvironmentMatcher: (macros: string[] \| Record<...>) => Ast.TypeGuard<...>; }` | Functions to match different types of nodes. | +| Name | Type | Description | +| :------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------- | +| `match` | `{ macro(node: any, macroName?: string): node is Ast.Macro; anyMacro(node: any): node is Ast.Macro; environment(node: any, envName?: string): node is Ast.Environment; ... 12 more ...; createEnvironmentMatcher: (macros: string[] \| Record) => Ast.TypeGuard; }` | Functions to match different types of nodes. | diff --git a/packages/unified-latex-util-parse/README.md b/packages/unified-latex-util-parse/README.md index 73d5c03f..5fadbb8c 100644 --- a/packages/unified-latex-util-parse/README.md +++ b/packages/unified-latex-util-parse/README.md @@ -51,18 +51,18 @@ Parse a string to a LaTeX AST. #### options ```typescript -{ mode?: "math" | "regular"; macros?: Ast.MacroInfoRecord; environments?: Ast.EnvInfoRecord; flags?: { atLetter?: boolean; expl3?: boolean; autodetectExpl3AndAtLetter?: boolean; }; } +{ mode?: "math" | "regular"; macros?: MacroInfoRecord; environments?: EnvInfoRecord; flags?: { atLetter?: boolean; expl3?: boolean; autodetectExpl3AndAtLetter?: boolean; }; } ``` ### Type -`Plugin<{ mode?: "math" | "regular"; macros?: Ast.MacroInfoRecord; environments?: Ast.EnvInfoRecord; flags?: { atLetter?: boolean; expl3?: boolean; autodetectExpl3AndAtLetter?: boolean; }; }[], string, Ast.Root>` +`Plugin<{ mode?: "math" | "regular"; macros?: MacroInfoRecord; environments?: EnvInfoRecord; flags?: { atLetter?: boolean; expl3?: boolean; autodetectExpl3AndAtLetter?: boolean; }; }[], string, Ast.Root>` ```typescript function unifiedLatexFromString(options: { mode?: "math" | "regular"; - macros?: Ast.MacroInfoRecord; - environments?: Ast.EnvInfoRecord; + macros?: MacroInfoRecord; + environments?: EnvInfoRecord; flags?: { atLetter?: boolean; expl3?: boolean; @@ -134,17 +134,17 @@ are reparsed (if needed) in math mode. #### options ```typescript -{ environments: Ast.EnvInfoRecord; macros: Ast.MacroInfoRecord; } +{ environments: EnvInfoRecord; macros: MacroInfoRecord; } ``` ### Type -`Plugin<{ environments: Ast.EnvInfoRecord; macros: Ast.MacroInfoRecord; }[], Ast.Root, Ast.Root>` +`Plugin<{ environments: EnvInfoRecord; macros: MacroInfoRecord; }[], Ast.Root, Ast.Root>` ```typescript function unifiedLatexProcessMacrosAndEnvironmentsWithMathReparse(options: { - environments: Ast.EnvInfoRecord; - macros: Ast.MacroInfoRecord; + environments: EnvInfoRecord; + macros: MacroInfoRecord; }): (tree: Ast.Root) => void; ``` diff --git a/packages/unified-latex-util-pgfkeys/README.md b/packages/unified-latex-util-pgfkeys/README.md index 9db9ca45..6b90de27 100644 --- a/packages/unified-latex-util-pgfkeys/README.md +++ b/packages/unified-latex-util-pgfkeys/README.md @@ -30,15 +30,7 @@ import the `.js` file. To explicitly access the commonjs export, import the `.cj ```typescript -function createMatchers(): { - isChar: (node: Ast.Node, char: string) => boolean; - isComma: (node: Ast.Node) => boolean; - isEquals: (node: Ast.Node) => boolean; - isWhitespace: (node: Ast.Node) => boolean; - isParbreak: (node: Ast.Node) => boolean; - isSameLineComment: (node: Ast.Node) => boolean; - isOwnLineComment: (node: Ast.Node) => boolean; -}; +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)` diff --git a/packages/unified-latex-util-scan/README.md b/packages/unified-latex-util-scan/README.md index 8e0000bb..6d5f18e8 100644 --- a/packages/unified-latex-util-scan/README.md +++ b/packages/unified-latex-util-scan/README.md @@ -29,7 +29,7 @@ Efficiently search for a large number of strings using a prefix-tree. The longest match is returned. ```typescript -function prefixMatch(nodes: Ast.Node[], prefixes: string | string[] | { dump(spacer?: number): string; tree(): any; addWord(word: string): ...; removeWord(word: string): ...; isPrefix(word: string): boolean; countPrefix(word: string): number; ... 5 more ...; getSubAnagrams(word: string): string[]; }, options: { startIndex?: number; matchSubstrings?: boolean; assumeOneCharStrings?: boolean; }): { match: string; endNodeIndex: number; endNodePartialMatch: string | null; } +function prefixMatch(nodes: Ast.Node[], prefixes: string | string[] | { dump(spacer?: number): string; tree(): any; addWord(word: string): ReturnType; removeWord(word: string): ReturnType; ... 7 more ...; getSubAnagrams(word: string): string[]; }, options: { startIndex?: number; matchSubstrings?: boolean; assumeOneCharStrings?: boolean; }): { match: string; endNodeIndex: number; endNodePartialMatch: string | null; } ``` **Parameters**