Files
edgeever/packages/shared/src/mathematics.ts
T
tianma-if d367f05821 perf: reduce Worker auth and sync overhead
Move workspace provisioning and seed work off the authentication hot path, compact sync changes, optimize cursor queries, and keep browser-only KaTeX rendering out of the Worker bundle.\n\nRefs #244
2026-08-14 16:44:38 +08:00

33 lines
870 B
TypeScript

import { BlockMath, InlineMath } from "@tiptap/extension-mathematics";
import {
BLOCK_MATH_NODE_TYPE,
edgeEverBlockMathMarkdownTokenizer,
edgeEverInlineMathMarkdownTokenizer,
INLINE_MATH_NODE_TYPE,
} from "./mathematics-markdown";
export {
BLOCK_MATH_NODE_TYPE,
INLINE_MATH_NODE_TYPE,
} from "./mathematics-markdown";
const EdgeEverInlineMath = InlineMath.extend({
markdownTokenizer: edgeEverInlineMathMarkdownTokenizer,
});
const EdgeEverBlockMath = BlockMath.extend({
markdownTokenizer: edgeEverBlockMathMarkdownTokenizer,
});
const katexOptions = {
throwOnError: false,
strict: "warn" as const,
trust: false,
};
/** Fresh extension instances for each TipTap editor or Markdown manager. */
export const createEdgeEverMathematics = () => [
EdgeEverBlockMath.configure({ katexOptions }),
EdgeEverInlineMath.configure({ katexOptions }),
];