diff --git a/packages/unified-latex-cli/libs/unified-args/index.ts b/packages/unified-latex-cli/libs/unified-args/index.ts index 47d814aa..f4e12060 100644 --- a/packages/unified-latex-cli/libs/unified-args/index.ts +++ b/packages/unified-latex-cli/libs/unified-args/index.ts @@ -12,6 +12,7 @@ import { } from "unified-engine"; import { unifiedLatexToHast } from "@unified-latex/unified-latex-to-hast"; import { unifiedLatexToMdast } from "@unified-latex/unified-latex-to-mdast"; +import { unifiedLatexToPretext } from "@unified-latex/unified-latex-to-pretext"; import { options, Options } from "./options"; import { availableLints } from "../lints"; import { statsJsonPlugin, statsPlugin } from "../stats"; @@ -168,6 +169,11 @@ export function unifiedArgs(cliConfig: Options) { config.plugins.push([remarkStringify as any]); } + if (config.pretext) { + config.plugins.push([unifiedLatexToPretext]); + config.plugins.push([prettyPrintHtmlPlugin]); + } + /** * Handle complete run. * diff --git a/packages/unified-latex-cli/libs/unified-args/options.ts b/packages/unified-latex-cli/libs/unified-args/options.ts index 2e1c81f5..8f9f74c5 100644 --- a/packages/unified-latex-cli/libs/unified-args/options.ts +++ b/packages/unified-latex-cli/libs/unified-args/options.ts @@ -158,6 +158,7 @@ export function options(flags: string[], configuration: Options) { ), html: config.html, markdown: config.markdown, + pretext: config.pretext, } as EngineOptions & { help: boolean; helpMessage: string; @@ -172,6 +173,7 @@ export function options(flags: string[], configuration: Options) { macro: { name: string; signature: string }[]; html: boolean; markdown: boolean; + pretext: boolean; }; } diff --git a/packages/unified-latex-cli/libs/unified-args/schema.ts b/packages/unified-latex-cli/libs/unified-args/schema.ts index e209256b..a15e4365 100644 --- a/packages/unified-latex-cli/libs/unified-args/schema.ts +++ b/packages/unified-latex-cli/libs/unified-args/schema.ts @@ -191,6 +191,13 @@ export const schema: Option[] = [ type: "boolean", default: false, }, + { + long: "pretext", + description: + "Convert the output to PreTeXt. Note, you should expand/replace any macros not recognized by the converter", + type: "boolean", + default: false, + }, { long: "stdout", description: "[Don't] write the processed file's contents to stdout",