remark-math-inline 1.0.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 weavepage
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # remark-math-inline
2
+
3
+ A [remark](https://github.com/remarkjs/remark) plugin for inline math using clean, unambiguous `:math[...]` syntax.
4
+
5
+ ## Why?
6
+
7
+ The standard `$...$` syntax for inline math has problems:
8
+ - **Ambiguity** — `$` conflicts with currency notation
9
+ - **Poor parsing** — Single `$` delimiters are hard to parse reliably
10
+ - **Tooling issues** — Many Markdown parsers don't handle `$` well
11
+
12
+ This plugin provides a cleaner alternative using explicit, directive-style syntax.
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ npm install remark-math-inline
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```javascript
23
+ import { unified } from 'unified'
24
+ import remarkParse from 'remark-parse'
25
+ import remarkMathInline from 'remark-math-inline'
26
+ import remarkRehype from 'remark-rehype'
27
+ import rehypeKatex from 'rehype-katex'
28
+ import rehypeStringify from 'rehype-stringify'
29
+
30
+ const html = await unified()
31
+ .use(remarkParse)
32
+ .use(remarkMathInline)
33
+ .use(remarkRehype)
34
+ .use(rehypeKatex)
35
+ .use(rehypeStringify)
36
+ .process('The formula :math[E = mc^2] is famous.')
37
+
38
+ console.log(String(html))
39
+ ```
40
+
41
+ ### Markdown Syntax
42
+
43
+ ```markdown
44
+ Inline math: :math[E = mc^2]
45
+
46
+ LaTeX commands work: :math[\alpha + \beta = \gamma]
47
+
48
+ Nested brackets are balanced: :math[f(x) = [a, b]]
49
+ ```
50
+
51
+ ### Block Math
52
+
53
+ For display-mode math, use fenced code blocks with `math` language:
54
+
55
+ ````markdown
56
+ ```math
57
+ \int_0^1 x^2 dx = \frac{1}{3}
58
+ ```
59
+ ````
60
+
61
+ This works out of the box with `rehype-katex` — no additional plugin needed.
62
+
63
+ ## Escaping
64
+
65
+ - `\]` → literal `]` (doesn't close the math)
66
+ - `\\` → literal `\`
67
+ - Other backslash sequences are preserved as-is (e.g., `\alpha` stays `\alpha`)
68
+
69
+ ## AST Node
70
+
71
+ The plugin creates `inlineMath` nodes compatible with `rehype-katex`:
72
+
73
+ ```typescript
74
+ interface InlineMath {
75
+ type: 'inlineMath'
76
+ value: string
77
+ data: {
78
+ hName: 'code'
79
+ hProperties: { className: ['language-math', 'math-inline'] }
80
+ hChildren: [{ type: 'text', value: string }]
81
+ }
82
+ }
83
+ ```
84
+
85
+ ## Adjacency
86
+
87
+ `:math[...]` must not be preceded by a word character. For adjacency without spaces, use parentheses:
88
+
89
+ ```markdown
90
+ mass(:math[m]) <!-- Works -->
91
+ mass:math[m] <!-- Does NOT parse -->
92
+ ```
93
+
94
+ ## Use with remark-directive
95
+
96
+ If you use both `remark-math-inline` and `remark-directive`, **the plugin registered last takes precedence** for `:math[...]` syntax.
97
+
98
+ ```javascript
99
+ // Math wins:
100
+ unified()
101
+ .use(remarkDirective)
102
+ .use(remarkMathInline) // registered last
103
+
104
+ // Directive wins:
105
+ unified()
106
+ .use(remarkMathInline)
107
+ .use(remarkDirective) // registered last
108
+ ```
109
+
110
+ ## License
111
+
112
+ MIT
@@ -0,0 +1,4 @@
1
+ import type { Processor } from 'unified';
2
+ export default function remarkMathInline(this: Processor): void;
3
+ export type { InlineMath } from 'mdast-util-math-inline';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,IAAI,EAAE,SAAS,QAavD;AAED,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ import { mathInline } from 'micromark-extension-math-inline';
2
+ import { mathInlineFromMarkdown, mathInlineToMarkdown } from 'mdast-util-math-inline';
3
+ export default function remarkMathInline() {
4
+ const data = this.data();
5
+ const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);
6
+ const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);
7
+ const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
8
+ micromarkExtensions.push(mathInline());
9
+ fromMarkdownExtensions.push(mathInlineFromMarkdown());
10
+ toMarkdownExtensions.push(mathInlineToMarkdown());
11
+ }
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAC5D,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAGrF,MAAM,CAAC,OAAO,UAAU,gBAAgB;IACtC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAExB,MAAM,mBAAmB,GACvB,IAAI,CAAC,mBAAmB,IAAI,CAAC,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC,CAAA;IAC7D,MAAM,sBAAsB,GAC1B,IAAI,CAAC,sBAAsB,IAAI,CAAC,IAAI,CAAC,sBAAsB,GAAG,EAAE,CAAC,CAAA;IACnE,MAAM,oBAAoB,GACxB,IAAI,CAAC,oBAAoB,IAAI,CAAC,IAAI,CAAC,oBAAoB,GAAG,EAAE,CAAC,CAAA;IAE/D,mBAAmB,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;IACtC,sBAAsB,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAA;IACrD,oBAAoB,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAA;AACnD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,190 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { unified } from 'unified';
3
+ import remarkParse from 'remark-parse';
4
+ import remarkStringify from 'remark-stringify';
5
+ import remarkRehype from 'remark-rehype';
6
+ import rehypeKatex from 'rehype-katex';
7
+ import rehypeStringify from 'rehype-stringify';
8
+ import remarkDirective from 'remark-directive';
9
+ import remarkMathInline from './index.js';
10
+ function parse(input) {
11
+ return unified()
12
+ .use(remarkParse)
13
+ .use(remarkMathInline)
14
+ .parse(input);
15
+ }
16
+ function stringify(tree) {
17
+ return unified()
18
+ .use(remarkParse)
19
+ .use(remarkMathInline)
20
+ .use(remarkStringify)
21
+ .stringify(tree);
22
+ }
23
+ function roundtrip(input) {
24
+ const tree = parse(input);
25
+ return stringify(tree);
26
+ }
27
+ describe('remark-math-inline', () => {
28
+ describe('parsing', () => {
29
+ it('creates inlineMath node', () => {
30
+ const tree = parse(':math[x^2]');
31
+ const paragraph = tree.children[0];
32
+ expect(paragraph.type).toBe('paragraph');
33
+ if (paragraph.type === 'paragraph') {
34
+ const math = paragraph.children[0];
35
+ expect(math.type).toBe('inlineMath');
36
+ expect(math.value).toBe('x^2');
37
+ }
38
+ });
39
+ it('includes hName and hProperties for rehype', () => {
40
+ const tree = parse(':math[x]');
41
+ const paragraph = tree.children[0];
42
+ if (paragraph.type === 'paragraph') {
43
+ const math = paragraph.children[0];
44
+ expect(math.data?.hName).toBe('code');
45
+ expect(math.data?.hProperties?.className).toContain('math-inline');
46
+ expect(math.data?.hProperties?.className).toContain('language-math');
47
+ }
48
+ });
49
+ it('handles escaped brackets', () => {
50
+ const tree = parse(':math[a\\]b]');
51
+ const paragraph = tree.children[0];
52
+ if (paragraph.type === 'paragraph') {
53
+ const math = paragraph.children[0];
54
+ expect(math.value).toBe('a]b');
55
+ }
56
+ });
57
+ it('handles escaped backslash', () => {
58
+ const tree = parse(':math[a\\\\]');
59
+ const paragraph = tree.children[0];
60
+ if (paragraph.type === 'paragraph') {
61
+ const math = paragraph.children[0];
62
+ expect(math.value).toBe('a\\');
63
+ }
64
+ });
65
+ it('preserves LaTeX commands', () => {
66
+ const tree = parse(':math[\\alpha + \\beta]');
67
+ const paragraph = tree.children[0];
68
+ if (paragraph.type === 'paragraph') {
69
+ const math = paragraph.children[0];
70
+ expect(math.value).toBe('\\alpha + \\beta');
71
+ }
72
+ });
73
+ });
74
+ describe('stringifying', () => {
75
+ it('escapes ] in output', () => {
76
+ const tree = {
77
+ type: 'root',
78
+ children: [{
79
+ type: 'paragraph',
80
+ children: [{
81
+ type: 'inlineMath',
82
+ value: 'a]b'
83
+ }]
84
+ }]
85
+ };
86
+ expect(stringify(tree).trim()).toBe(':math[a\\]b]');
87
+ });
88
+ it('escapes \\ before ] in output', () => {
89
+ const tree = {
90
+ type: 'root',
91
+ children: [{
92
+ type: 'paragraph',
93
+ children: [{
94
+ type: 'inlineMath',
95
+ value: 'a\\]'
96
+ }]
97
+ }]
98
+ };
99
+ expect(stringify(tree).trim()).toBe(':math[a\\\\\\]]');
100
+ });
101
+ it('escapes unbalanced [ in output', () => {
102
+ const tree = {
103
+ type: 'root',
104
+ children: [{
105
+ type: 'paragraph',
106
+ children: [{
107
+ type: 'inlineMath',
108
+ value: '['
109
+ }]
110
+ }]
111
+ };
112
+ expect(stringify(tree).trim()).toBe(':math[\\[]');
113
+ });
114
+ });
115
+ describe('round-trip', () => {
116
+ it('preserves simple math', () => {
117
+ const input = ':math[x^2]';
118
+ expect(roundtrip(input).trim()).toBe(input);
119
+ });
120
+ it('preserves LaTeX commands', () => {
121
+ const input = ':math[\\alpha + \\beta]';
122
+ expect(roundtrip(input).trim()).toBe(input);
123
+ });
124
+ it('preserves nested brackets', () => {
125
+ const input = ':math[f(x) = [a, b]]';
126
+ expect(roundtrip(input).trim()).toBe(input);
127
+ });
128
+ });
129
+ });
130
+ describe('rehype-katex integration', () => {
131
+ async function toHtml(input) {
132
+ const result = await unified()
133
+ .use(remarkParse)
134
+ .use(remarkMathInline)
135
+ .use(remarkRehype)
136
+ .use(rehypeKatex)
137
+ .use(rehypeStringify)
138
+ .process(input);
139
+ return String(result);
140
+ }
141
+ it('renders inline math with katex', async () => {
142
+ const html = await toHtml(':math[x^2]');
143
+ expect(html).toContain('katex');
144
+ expect(html).toContain('x');
145
+ expect(html).toContain('2');
146
+ });
147
+ it('renders LaTeX commands', async () => {
148
+ const html = await toHtml(':math[\\alpha]');
149
+ expect(html).toContain('katex');
150
+ expect(html).toContain('α'); // Greek alpha
151
+ });
152
+ it('renders complex expressions', async () => {
153
+ const html = await toHtml(':math[E = mc^2]');
154
+ expect(html).toContain('katex');
155
+ });
156
+ it('handles fenced math blocks (```math)', async () => {
157
+ const html = await toHtml('```math\nx^2\n```');
158
+ expect(html).toContain('katex');
159
+ });
160
+ });
161
+ describe('remark-directive compatibility', () => {
162
+ it('parses :math[...] as inlineMath when remarkMathInline is registered AFTER remarkDirective', () => {
163
+ // The plugin registered LAST takes precedence for overlapping syntax
164
+ const tree = unified()
165
+ .use(remarkParse)
166
+ .use(remarkDirective)
167
+ .use(remarkMathInline) // registered last = wins
168
+ .parse(':math[x^2]');
169
+ const paragraph = tree.children[0];
170
+ if (paragraph.type === 'paragraph') {
171
+ const first = paragraph.children[0];
172
+ expect(first.type).toBe('inlineMath');
173
+ expect(first.value).toBe('x^2');
174
+ }
175
+ });
176
+ it('parses :math[...] as textDirective when remarkDirective is registered AFTER remarkMathInline', () => {
177
+ // The plugin registered LAST takes precedence
178
+ const tree = unified()
179
+ .use(remarkParse)
180
+ .use(remarkMathInline)
181
+ .use(remarkDirective) // registered last = wins
182
+ .parse(':math[x^2]');
183
+ const paragraph = tree.children[0];
184
+ if (paragraph.type === 'paragraph') {
185
+ const first = paragraph.children[0];
186
+ expect(first.type).toBe('textDirective');
187
+ }
188
+ });
189
+ });
190
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,WAAW,MAAM,cAAc,CAAA;AACtC,OAAO,eAAe,MAAM,kBAAkB,CAAA;AAC9C,OAAO,YAAY,MAAM,eAAe,CAAA;AACxC,OAAO,WAAW,MAAM,cAAc,CAAA;AACtC,OAAO,eAAe,MAAM,kBAAkB,CAAA;AAC9C,OAAO,eAAe,MAAM,kBAAkB,CAAA;AAC9C,OAAO,gBAAgB,MAAM,YAAY,CAAA;AAIzC,SAAS,KAAK,CAAC,KAAa;IAC1B,OAAO,OAAO,EAAE;SAC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AC,CAAC,CAAC,CAAA;YACnC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QAC1C,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "remark-math-inline",
3
+ "version": "1.0.0",
4
+ "description": "Remark plugin for inline math syntax (:math[...])",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "test": "vitest run",
20
+ "test:watch": "vitest",
21
+ "clean": "rm -rf dist"
22
+ },
23
+ "dependencies": {
24
+ "mdast-util-math-inline": "^1.0.0",
25
+ "micromark-extension-math-inline": "^1.0.0"
26
+ },
27
+ "peerDependencies": {
28
+ "unified": ">=11"
29
+ },
30
+ "devDependencies": {
31
+ "@types/mdast": "^4.0.0",
32
+ "rehype-katex": "^7.0.1",
33
+ "rehype-stringify": "^10.0.1",
34
+ "remark-directive": "^4.0.0",
35
+ "remark-parse": "^11.0.0",
36
+ "remark-rehype": "^11.1.2",
37
+ "remark-stringify": "^11.0.0",
38
+ "typescript": "^5.7.0",
39
+ "unified": "^11.0.0",
40
+ "vitest": "^2.0.0"
41
+ },
42
+ "keywords": [
43
+ "remark",
44
+ "unified",
45
+ "math",
46
+ "latex",
47
+ "katex",
48
+ "inline"
49
+ ],
50
+ "license": "MIT",
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "https://github.com/weavepage/remark-math-inline.git",
54
+ "directory": "packages/remark-math-inline"
55
+ }
56
+ }