{"version":3,"file":"index.cjs","names":[],"sources":["../../../rules/unified-latex-lint-no-tex-display-math/index.ts"],"sourcesContent":["import { lintRule } from \"unified-lint-rule\";\nimport * as Ast from \"@unified-latex/unified-latex-types\";\nimport { match } from \"@unified-latex/unified-latex-util-match\";\nimport { visit } from \"@unified-latex/unified-latex-util-visit\";\n\ntype PluginOptions = undefined;\n\nexport const DESCRIPTION = `## Lint Rule\n\nAvoid using TeX display math command \\`$$...$$\\`. Instead prefer \\`\\\\[...\\\\] \\`.\n\nWhen printing processed latex, \\`$$...$$\\` is automatically replaced with \\`\\\\[...\\\\] \\`.\n\n### See\n\nCTAN l2tabuen Section 1.7`;\n\nexport const unifiedLatexLintNoTexDisplayMath = lintRule<\n    Ast.Root,\n    PluginOptions\n>(\n    { origin: \"unified-latex-lint:no-tex-display-math\" },\n    (tree, file, options) => {\n        visit(\n            tree,\n            (node) => {\n                if (node.type !== \"displaymath\" || node.position == null) {\n                    return;\n                }\n                if (\n                    file.value &&\n                    file.value.slice(\n                        node.position.start.offset,\n                        node.position.start.offset + 2\n                    ) === \"$$\"\n                ) {\n                    file.message(\n                        `Avoid using $$...$$ for display math; prefer \\\\[...\\\\]`,\n                        node\n                    );\n                }\n            },\n            { test: match.math }\n        );\n    }\n);\n"],"mappings":";;;;;AAOA,IAAa,cAAc;;;;;;;;;AAU3B,IAAa,mCAAmC,YAAA,SAI5C,EAAE,QAAQ,0CAA0C,GACnD,MAAM,MAAM,YAAY;AACrB,EAAA,GAAA,wCAAA,OACI,OACC,SAAS;AACN,MAAI,KAAK,SAAS,iBAAiB,KAAK,YAAY,KAChD;AAEJ,MACI,KAAK,SACL,KAAK,MAAM,MACP,KAAK,SAAS,MAAM,QACpB,KAAK,SAAS,MAAM,SAAS,EAChC,KAAK,KAEN,MAAK,QACD,0DACA,KACH;IAGT,EAAE,MAAM,wCAAA,MAAM,MAAM,CACvB;EAER"}