remark-clang-format
Version:
run clang-format for code in markdown
16 lines (13 loc) • 419 B
JavaScript
import { visit, CONTINUE } from 'unist-util-visit';
import { format } from 'prettier';
import { prettierPluginLatexMath } from './prettier-plugin-latex-math.js';
function visitor(node) {
node.value = format(node.value, {
plugins: [prettierPluginLatexMath],
parser: 'unified-latex-math',
});
return CONTINUE;
}
export default function formatMath(tree) {
visit(tree, ['math', 'inlineMath'], visitor);
}