@clidey/dory 0.11.0 → 0.12.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/package.json +1 -1
- package/src/plugins/sanitize.ts +4 -1
package/package.json
CHANGED
package/src/plugins/sanitize.ts
CHANGED
|
@@ -40,8 +40,11 @@ export function preprocessMdxTags() {
|
|
|
40
40
|
transform(code: string, id: string) {
|
|
41
41
|
if (!id.endsWith('.mdx')) return;
|
|
42
42
|
|
|
43
|
+
// Remove leading whitespace from code fence blocks
|
|
44
|
+
let processed = code.replace(/^(\s+)(```\w*)/gm, '$2');
|
|
45
|
+
|
|
43
46
|
// Replace unrecognized <someTag> with `"<someTag>"`
|
|
44
|
-
|
|
47
|
+
processed = processed.replace(/<([a-z][a-z0-9]+)>/gi, (match, tag) => {
|
|
45
48
|
const known = KNOWN_COMPONENTS.includes(tag);
|
|
46
49
|
return known ? match : `\`<${tag}>\``; // wrap in backticks to keep as code
|
|
47
50
|
});
|