@bdocs/plugin-math 2.0.2 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,11 @@
1
+
1
2
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
3
 
3
4
  //#region src/client/Math.d.ts
4
5
  interface MathProps {
5
6
  children: string;
6
7
  }
7
- declare function Math({
8
+ declare function MathComponent({
8
9
  children
9
10
  }: MathProps): _$react_jsx_runtime0.JSX.Element;
10
11
  //#endregion
@@ -16,4 +17,4 @@ declare function BlockMath({
16
17
  children
17
18
  }: BlockMathProps): _$react_jsx_runtime0.JSX.Element;
18
19
  //#endregion
19
- export { BlockMath, Math };
20
+ export { BlockMath, MathComponent as Math, MathComponent };
@@ -1,8 +1,13 @@
1
+ /**
2
+ * Boltdocs - https://boltdocs.vercel.app
3
+ * Copyright (c) 2026 Jesus Alcala
4
+ * Licensed under the MIT License.
5
+ */
1
6
  import { useMemo } from "react";
2
7
  import katex from "katex";
3
8
  import { jsx } from "react/jsx-runtime";
4
9
  //#region src/client/Math.tsx
5
- function Math({ children }) {
10
+ function MathComponent({ children }) {
6
11
  return /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: useMemo(() => {
7
12
  try {
8
13
  return katex.renderToString(children, { displayMode: false });
@@ -26,4 +31,4 @@ function BlockMath({ children }) {
26
31
  });
27
32
  }
28
33
  //#endregion
29
- export { BlockMath, Math };
34
+ export { BlockMath, MathComponent as Math, MathComponent };
@@ -1,3 +1,4 @@
1
+
1
2
  import { BoltdocsPlugin } from "boltdocs";
2
3
 
3
4
  //#region src/node/index.d.ts
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Boltdocs - https://boltdocs.vercel.app
3
+ * Copyright (c) 2026 Jesus Alcala
4
+ * Licensed under the MIT License.
5
+ */
1
6
  //#region src/node/source-transform.ts
2
7
  function escapeJsString(content) {
3
8
  return content.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n");
@@ -20,7 +25,7 @@ function preprocessMath(source) {
20
25
  return `<BlockMath>{"${escapeJsString(content.trim())}"}</BlockMath>`;
21
26
  });
22
27
  result = result.replace(/(?<!\$)\$(?!\$)(.+?)\$(?!\$)/g, (_, content) => {
23
- return `<Math>{"${escapeJsString(content)}"}</Math>`;
28
+ return `<MathComponent>{"${escapeJsString(content)}"}</MathComponent>`;
24
29
  });
25
30
  while (result.includes("\0MATH_PH_")) result = result.replace(/\0MATH_PH_(\d+)\0/g, (_, idx) => {
26
31
  return placeholders[parseInt(idx)];
@@ -39,6 +44,7 @@ function mathPlugin() {
39
44
  hooks: { transformSource },
40
45
  components: {
41
46
  Math: "@bdocs/plugin-math/client",
47
+ MathComponent: "@bdocs/plugin-math/client",
42
48
  BlockMath: "@bdocs/plugin-math/client"
43
49
  }
44
50
  };
package/package.json CHANGED
@@ -1,10 +1,7 @@
1
1
  {
2
2
  "name": "@bdocs/plugin-math",
3
- "version": "2.0.2",
3
+ "version": "4.0.1",
4
4
  "description": "KaTeX math plugin for Boltdocs",
5
- "main": "dist/node/index.js",
6
- "module": "dist/node/index.mjs",
7
- "types": "dist/node/index.d.ts",
8
5
  "publishConfig": {
9
6
  "access": "public"
10
7
  },
@@ -32,7 +29,7 @@
32
29
  "@bdocs/dui": "^0.2.0",
33
30
  "react": "^19.0.0",
34
31
  "react-dom": "^19.0.0",
35
- "boltdocs": "3.0.2"
32
+ "boltdocs": "3.2.1"
36
33
  },
37
34
  "devDependencies": {
38
35
  "@types/katex": "^0.16.7",
@@ -43,10 +40,10 @@
43
40
  "react-dom": "^19.0.0",
44
41
  "tsdown": "^0.21.7",
45
42
  "typescript": "^5.9.3",
46
- "boltdocs": "3.0.2"
43
+ "boltdocs": "3.2.1"
47
44
  },
48
45
  "scripts": {
49
- "build": "tsdown --config-loader unrun && node -e \"require('fs').cpSync('src/client/index.css', 'dist/client/index.css')\"",
46
+ "build": "tsdown --config-loader unrun && node --input-type=module -e \"import fs from 'node:fs'; fs.mkdirSync('dist/client', { recursive: true }); fs.cpSync('src/client/index.css', 'dist/client/index.css');\"",
50
47
  "dev": "tsdown --watch --config-loader unrun",
51
48
  "test": "vitest run"
52
49
  }