safe-mdx 1.3.3 → 1.3.7
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/dist/html/html-to-mdx-ast.d.ts +4 -2
- package/dist/html/html-to-mdx-ast.d.ts.map +1 -1
- package/dist/html/html-to-mdx-ast.js +105 -45
- package/dist/html/html-to-mdx-ast.js.map +1 -1
- package/dist/html/html-to-mdx-ast.test.js +365 -4
- package/dist/html/html-to-mdx-ast.test.js.map +1 -1
- package/dist/html/remark-mdx-jsx-normalize.d.ts +1 -1
- package/dist/html/remark-mdx-jsx-normalize.d.ts.map +1 -1
- package/dist/html/remark-mdx-jsx-normalize.js +92 -15
- package/dist/html/remark-mdx-jsx-normalize.js.map +1 -1
- package/dist/parse.d.ts +2 -2
- package/dist/parse.d.ts.map +1 -1
- package/dist/parse.js +2 -2
- package/dist/parse.js.map +1 -1
- package/dist/safe-mdx.d.ts +1 -1
- package/dist/safe-mdx.d.ts.map +1 -1
- package/dist/safe-mdx.js +8 -12
- package/dist/safe-mdx.js.map +1 -1
- package/package.json +2 -1
- package/src/html/html-to-mdx-ast.test.ts +393 -3
- package/src/html/html-to-mdx-ast.ts +118 -47
- package/src/html/remark-mdx-jsx-normalize.ts +98 -17
- package/src/parse.ts +2 -2
- package/src/safe-mdx.tsx +8 -11
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RootContent } from 'mdast';
|
|
2
|
-
|
|
2
|
+
import { remarkMdxJsxNormalize } from './remark-mdx-jsx-normalize.js';
|
|
3
|
+
export { remarkMdxJsxNormalize };
|
|
3
4
|
export type ConvertTagName = (args: {
|
|
4
5
|
tagName: string;
|
|
5
6
|
}) => string;
|
|
@@ -13,11 +14,12 @@ export type ConvertAttributeValue = (args: {
|
|
|
13
14
|
}) => string;
|
|
14
15
|
export interface ParseHtmlToMdxAstOptions {
|
|
15
16
|
html: string;
|
|
17
|
+
parentType?: string;
|
|
16
18
|
onError?: (error: unknown, text: string) => void;
|
|
17
19
|
convertTagName?: ConvertTagName;
|
|
18
20
|
textToMdast?: TextToMdast;
|
|
19
21
|
convertAttributeValue?: ConvertAttributeValue;
|
|
20
22
|
}
|
|
21
|
-
export declare function htmlToMdxAst(options: ParseHtmlToMdxAstOptions): RootContent
|
|
23
|
+
export declare function htmlToMdxAst(options: ParseHtmlToMdxAstOptions): RootContent[];
|
|
22
24
|
export declare function parseHtmlToMdxAst(options: ParseHtmlToMdxAstOptions): RootContent[];
|
|
23
25
|
//# sourceMappingURL=html-to-mdx-ast.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-to-mdx-ast.d.ts","sourceRoot":"","sources":["../../src/html/html-to-mdx-ast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,WAAW,EAAqB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"html-to-mdx-ast.d.ts","sourceRoot":"","sources":["../../src/html/html-to-mdx-ast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,WAAW,EAAqB,MAAM,OAAO,CAAA;AAUjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAGrE,OAAO,EAAE,qBAAqB,EAAE,CAAA;AAGhC,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,KAAK,MAAM,CAAA;AAGlE,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE;IAC7B,IAAI,EAAE,MAAM,CAAA;CACf,KAAK,WAAW,GAAG,WAAW,EAAE,CAAA;AAGjC,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;CAClB,KAAK,MAAM,CAAA;AAGZ,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChD,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;CAChD;AAkQD,wBAAgB,YAAY,CAAC,OAAO,EAAE,wBAAwB,GAAG,WAAW,EAAE,CAsE7E;AAID,wBAAgB,iBAAiB,CAC7B,OAAO,EAAE,wBAAwB,GAClC,WAAW,EAAE,CAEf"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { unified } from 'unified';
|
|
1
2
|
import { convertAttributeNameToJSX } from './convert-attributes.js';
|
|
2
3
|
import { parseHTML } from './domparser.js';
|
|
4
|
+
import { remarkMdxJsxNormalize } from './remark-mdx-jsx-normalize.js';
|
|
3
5
|
// Re-export the normalize plugin
|
|
4
|
-
export {
|
|
6
|
+
export { remarkMdxJsxNormalize };
|
|
5
7
|
// Type guard functions for DOM nodes
|
|
6
8
|
function isCommentNode(node) {
|
|
7
9
|
return node.nodeType === 8; // Node.COMMENT_NODE
|
|
@@ -20,6 +22,28 @@ function defaultConvertTagName({ tagName }) {
|
|
|
20
22
|
function defaultConvertAttributeValue({ value, }) {
|
|
21
23
|
return value;
|
|
22
24
|
}
|
|
25
|
+
// Remove common indentation from multi-line text while preserving relative indentation
|
|
26
|
+
function deindent(text) {
|
|
27
|
+
const lines = text.split('\n');
|
|
28
|
+
// Find minimum indentation (excluding empty lines)
|
|
29
|
+
let minIndent = Infinity;
|
|
30
|
+
for (const line of lines) {
|
|
31
|
+
if (line.trim()) {
|
|
32
|
+
const match = line.match(/^(\s*)/);
|
|
33
|
+
if (match) {
|
|
34
|
+
minIndent = Math.min(minIndent, match[1].length);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// If no indentation found, return as is
|
|
39
|
+
if (minIndent === 0 || minIndent === Infinity) {
|
|
40
|
+
return text;
|
|
41
|
+
}
|
|
42
|
+
// Remove common indentation from each line, preserving relative indentation
|
|
43
|
+
return lines
|
|
44
|
+
.map(line => line.slice(minIndent))
|
|
45
|
+
.join('\n');
|
|
46
|
+
}
|
|
23
47
|
// Convert HTML attribute to MDX JSX attribute
|
|
24
48
|
function convertAttribute(attr, tagName, options) {
|
|
25
49
|
let jsxName = convertAttributeNameToJSX(attr.name);
|
|
@@ -96,24 +120,42 @@ function convertAttribute(attr, tagName, options) {
|
|
|
96
120
|
value: value,
|
|
97
121
|
};
|
|
98
122
|
}
|
|
99
|
-
// Convert DOM node to MDX AST nodes
|
|
123
|
+
// Convert DOM node to MDX AST nodes - always returns an array
|
|
100
124
|
function htmlNodeToMdxAst(node, options) {
|
|
101
125
|
if (isCommentNode(node)) {
|
|
102
126
|
// Convert comments to MDX JSX expression with comment
|
|
103
|
-
// For now, return
|
|
104
|
-
// return {
|
|
127
|
+
// For now, return empty array
|
|
128
|
+
// return [{
|
|
105
129
|
// type: 'html',
|
|
106
130
|
// value: `<!-- ${node.data} -->`
|
|
107
|
-
// } as Html
|
|
131
|
+
// }] as Html[]
|
|
108
132
|
return [];
|
|
109
133
|
}
|
|
110
134
|
if (isTextNode(node)) {
|
|
111
|
-
|
|
135
|
+
let textValue = node.textContent || '';
|
|
136
|
+
// Skip whitespace-only nodes between elements
|
|
137
|
+
if (!textValue.trim()) {
|
|
138
|
+
const prevSibling = node.previousSibling;
|
|
139
|
+
const nextSibling = node.nextSibling;
|
|
140
|
+
// If between elements and contains newlines, it's likely formatting
|
|
141
|
+
if (textValue.includes('\n') &&
|
|
142
|
+
((prevSibling && isElementNode(prevSibling)) ||
|
|
143
|
+
(nextSibling && isElementNode(nextSibling)))) {
|
|
144
|
+
return [];
|
|
145
|
+
}
|
|
146
|
+
// Otherwise preserve the whitespace (could be intentional space)
|
|
147
|
+
}
|
|
148
|
+
// Always deindent text content
|
|
149
|
+
textValue = deindent(textValue).trim();
|
|
150
|
+
// Skip empty text after processing
|
|
151
|
+
if (!textValue) {
|
|
152
|
+
return [];
|
|
153
|
+
}
|
|
112
154
|
// If we have a textToMdast converter, use it
|
|
113
155
|
if (options?.textToMdast) {
|
|
114
156
|
try {
|
|
115
157
|
const result = options.textToMdast({ text: textValue });
|
|
116
|
-
return result;
|
|
158
|
+
return Array.isArray(result) ? result : [result];
|
|
117
159
|
}
|
|
118
160
|
catch (error) {
|
|
119
161
|
// Call onError callback if provided, otherwise log
|
|
@@ -125,17 +167,21 @@ function htmlNodeToMdxAst(node, options) {
|
|
|
125
167
|
console.error('Text content:', textValue);
|
|
126
168
|
}
|
|
127
169
|
// Fallback to simple text node
|
|
128
|
-
return
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
170
|
+
return [
|
|
171
|
+
{
|
|
172
|
+
type: 'text',
|
|
173
|
+
value: textValue,
|
|
174
|
+
},
|
|
175
|
+
];
|
|
132
176
|
}
|
|
133
177
|
}
|
|
134
178
|
// Default: return simple text node
|
|
135
|
-
return
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
179
|
+
return [
|
|
180
|
+
{
|
|
181
|
+
type: 'text',
|
|
182
|
+
value: textValue,
|
|
183
|
+
},
|
|
184
|
+
];
|
|
139
185
|
}
|
|
140
186
|
if (!isElementNode(node)) {
|
|
141
187
|
return [];
|
|
@@ -148,13 +194,7 @@ function htmlNodeToMdxAst(node, options) {
|
|
|
148
194
|
// Process children but skip the element wrapper
|
|
149
195
|
const children = [];
|
|
150
196
|
for (const child of Array.from(node.childNodes)) {
|
|
151
|
-
|
|
152
|
-
if (Array.isArray(result)) {
|
|
153
|
-
children.push(...result);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
children.push(result);
|
|
157
|
-
}
|
|
197
|
+
children.push(...htmlNodeToMdxAst(child, options));
|
|
158
198
|
}
|
|
159
199
|
return children;
|
|
160
200
|
}
|
|
@@ -166,13 +206,7 @@ function htmlNodeToMdxAst(node, options) {
|
|
|
166
206
|
// Process children
|
|
167
207
|
const children = [];
|
|
168
208
|
for (const child of Array.from(node.childNodes)) {
|
|
169
|
-
|
|
170
|
-
if (Array.isArray(result)) {
|
|
171
|
-
children.push(...result);
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
children.push(result);
|
|
175
|
-
}
|
|
209
|
+
children.push(...htmlNodeToMdxAst(child, options));
|
|
176
210
|
}
|
|
177
211
|
// Always create MdxJsxTextElement initially
|
|
178
212
|
// The conversion to MdxJsxFlowElement will be handled by a separate plugin
|
|
@@ -182,9 +216,9 @@ function htmlNodeToMdxAst(node, options) {
|
|
|
182
216
|
attributes,
|
|
183
217
|
children: children,
|
|
184
218
|
};
|
|
185
|
-
return element;
|
|
219
|
+
return [element];
|
|
186
220
|
}
|
|
187
|
-
// Main function to parse HTML and return MDX AST
|
|
221
|
+
// Main function to parse HTML and return MDX AST - always returns an array
|
|
188
222
|
export function htmlToMdxAst(options) {
|
|
189
223
|
// Parse HTML with linkedom
|
|
190
224
|
const { document } = parseHTML(options.html.trim());
|
|
@@ -200,28 +234,54 @@ export function htmlToMdxAst(options) {
|
|
|
200
234
|
const childNodes = Array.from(document.childNodes).filter((node) => node.nodeType === 1 || // Element nodes
|
|
201
235
|
node.nodeType === 3 || // Text nodes
|
|
202
236
|
node.nodeType === 8);
|
|
203
|
-
|
|
204
|
-
return [];
|
|
205
|
-
}
|
|
206
|
-
if (childNodes.length === 1) {
|
|
207
|
-
return htmlNodeToMdxAst(childNodes[0], options);
|
|
208
|
-
}
|
|
209
|
-
// Multiple nodes - return as array
|
|
210
|
-
const results = [];
|
|
237
|
+
let results = [];
|
|
211
238
|
for (const node of childNodes) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
239
|
+
results.push(...htmlNodeToMdxAst(node, options));
|
|
240
|
+
}
|
|
241
|
+
// Apply the normalize plugin if we have a parentType
|
|
242
|
+
if (options.parentType && results.length > 0) {
|
|
243
|
+
// Create a temporary AST node with the same parent type
|
|
244
|
+
const parentType = options.parentType;
|
|
245
|
+
const tempRoot = {
|
|
246
|
+
type: 'root',
|
|
247
|
+
children: results,
|
|
248
|
+
};
|
|
249
|
+
// If we have a specific parent type, wrap the content in that parent
|
|
250
|
+
// to provide proper context for the normalize plugin
|
|
251
|
+
let astToProcess;
|
|
252
|
+
if (parentType !== 'root') {
|
|
253
|
+
// Create a parent node of the specified type with our content as children
|
|
254
|
+
const parentNode = {
|
|
255
|
+
type: parentType,
|
|
256
|
+
children: tempRoot.children,
|
|
257
|
+
};
|
|
258
|
+
astToProcess = {
|
|
259
|
+
type: 'root',
|
|
260
|
+
children: [parentNode],
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
astToProcess = tempRoot;
|
|
265
|
+
}
|
|
266
|
+
// Create a simple processor and run the normalize plugin
|
|
267
|
+
const processor = unified().use(remarkMdxJsxNormalize);
|
|
268
|
+
processor.runSync(astToProcess);
|
|
269
|
+
// Extract the result back
|
|
270
|
+
if (parentType !== 'root') {
|
|
271
|
+
// Get the children from the parent node we created
|
|
272
|
+
const processedParent = astToProcess.children[0];
|
|
273
|
+
results = processedParent.children;
|
|
215
274
|
}
|
|
216
275
|
else {
|
|
217
|
-
|
|
276
|
+
// Get children directly from root
|
|
277
|
+
results = astToProcess.children;
|
|
218
278
|
}
|
|
219
279
|
}
|
|
220
280
|
return results;
|
|
221
281
|
}
|
|
222
282
|
// Export a wrapper that always returns an array for consistency
|
|
283
|
+
// Note: htmlToMdxAst now already returns an array, so this is just an alias
|
|
223
284
|
export function parseHtmlToMdxAst(options) {
|
|
224
|
-
|
|
225
|
-
return Array.isArray(result) ? result : [result];
|
|
285
|
+
return htmlToMdxAst(options);
|
|
226
286
|
}
|
|
227
287
|
//# sourceMappingURL=html-to-mdx-ast.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-to-mdx-ast.js","sourceRoot":"","sources":["../../src/html/html-to-md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