@readme/markdown 13.7.2 → 13.7.4
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/components/CodeTabs/index.tsx +62 -19
- package/components/Glossary/index.tsx +3 -0
- package/components/TailwindStyle/index.tsx +8 -17
- package/dist/lib/mdast-util/gemoji/index.d.ts +2 -0
- package/dist/lib/micromark/gemoji/index.d.ts +4 -0
- package/dist/lib/micromark/gemoji/syntax.d.ts +9 -0
- package/dist/main.js +738 -232
- package/dist/main.node.js +738 -232
- package/dist/main.node.js.map +1 -1
- package/dist/processor/transform/extract-text.d.ts +1 -1
- package/dist/processor/transform/mdxish/close-self-closing-html-tags.d.ts +23 -0
- package/dist/processor/transform/mdxish/magic-blocks/types.d.ts +0 -12
- package/dist/processor/transform/mdxish/mdxish-jsx-to-mdast.d.ts +5 -3
- package/dist/processor/transform/mdxish/types.d.ts +15 -0
- package/package.json +2 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String-level preprocessor that converts self-closing non-void HTML tags
|
|
3
|
+
* into explicitly closed tags.
|
|
4
|
+
*
|
|
5
|
+
* Problem: `rehype-raw` (via parse5) follows the HTML spec where the `/` in
|
|
6
|
+
* `<i />` is ignored for non-void elements. This causes `<i />` to be parsed
|
|
7
|
+
* as an opening `<i>` tag, which then wraps all subsequent content.
|
|
8
|
+
*
|
|
9
|
+
* Solution: Transform `<i />` → `<i></i>` before parsing, so rehype-raw
|
|
10
|
+
* sees a properly closed element.
|
|
11
|
+
*
|
|
12
|
+
* This preprocessor:
|
|
13
|
+
* - Skips void elements (`<br />`, `<hr />`, `<img />`, etc.)
|
|
14
|
+
* - Skips PascalCase tags (custom components handled elsewhere)
|
|
15
|
+
* - Protects code blocks from transformation
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* closeSelfClosingHtmlTags('<i/> text') // '<i></i> text'
|
|
19
|
+
* closeSelfClosingHtmlTags('<br />') // '<br />' (void, untouched)
|
|
20
|
+
* closeSelfClosingHtmlTags('<MyComp />') // '<MyComp />' (PascalCase, untouched)
|
|
21
|
+
* closeSelfClosingHtmlTags('<i class="icon" />') // '<i class="icon"></i>'
|
|
22
|
+
*/
|
|
23
|
+
export declare function closeSelfClosingHtmlTags(content: string): string;
|
|
@@ -110,15 +110,3 @@ export interface MagicBlockEmbed {
|
|
|
110
110
|
position?: Position;
|
|
111
111
|
type: 'embed';
|
|
112
112
|
}
|
|
113
|
-
/**
|
|
114
|
-
* Figure node that may contain an image (from magicBlockTransformer with caption).
|
|
115
|
-
* This is an intermediate format before conversion to Figure.
|
|
116
|
-
*/
|
|
117
|
-
export interface MagicBlockFigure {
|
|
118
|
-
children: RootContent[];
|
|
119
|
-
data?: {
|
|
120
|
-
hName?: string;
|
|
121
|
-
};
|
|
122
|
-
position?: Position;
|
|
123
|
-
type: 'figure';
|
|
124
|
-
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { Parent } from 'mdast';
|
|
2
2
|
import type { Plugin } from 'unified';
|
|
3
3
|
/**
|
|
4
|
-
* Transform mdxJsxFlowElement nodes
|
|
4
|
+
* Transform mdxJsxFlowElement nodes, magic block nodes, and HTML figure elements
|
|
5
|
+
* into proper MDAST node types.
|
|
5
6
|
*
|
|
6
7
|
* This transformer runs after mdxishComponentBlocks and converts:
|
|
7
|
-
* - JSX component elements (Image, Callout, Embed, Recipe) into their corresponding MDAST types
|
|
8
|
+
* - JSX component elements (Image, Callout, Embed, Recipe, figure) into their corresponding MDAST types
|
|
8
9
|
* - Magic block image nodes (type: 'image') into image-block
|
|
9
10
|
* - Magic block embed nodes (type: 'embed') into embed-block
|
|
10
|
-
* -
|
|
11
|
+
* - Fragmented HTML <figure> blocks (from terminateHtmlFlowBlocks) back into figure nodes
|
|
12
|
+
* - Figure nodes (from magic blocks, HTML, or JSX) into flat image-block with caption string
|
|
11
13
|
* - Normalizes all image-block attrs (border, align, sizing, caption) to a consistent shape
|
|
12
14
|
*
|
|
13
15
|
* This is controlled by the `newEditorTypes` flag to maintain backwards compatibility.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RootContent } from 'mdast';
|
|
2
|
+
import type { Position } from 'unist';
|
|
3
|
+
/**
|
|
4
|
+
* Intermediate figure node before conversion to the final Figure type.
|
|
5
|
+
* Produced by magicBlockTransformer (for magic block images with captions)
|
|
6
|
+
* and by reassembleHtmlFigures (for raw HTML <figure> elements).
|
|
7
|
+
*/
|
|
8
|
+
export interface FigureNode {
|
|
9
|
+
children: RootContent[];
|
|
10
|
+
data?: {
|
|
11
|
+
hName?: string;
|
|
12
|
+
};
|
|
13
|
+
position?: Position;
|
|
14
|
+
type: 'figure';
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@readme/markdown",
|
|
3
3
|
"description": "ReadMe's React-based Markdown parser",
|
|
4
4
|
"author": "Rafe Goldberg <rafe@readme.io>",
|
|
5
|
-
"version": "13.7.
|
|
5
|
+
"version": "13.7.4",
|
|
6
6
|
"main": "dist/main.node.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"browser": "dist/main.js",
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
171
|
"path": "dist/main.node.js",
|
|
172
|
-
"maxSize": "
|
|
172
|
+
"maxSize": "860KB"
|
|
173
173
|
}
|
|
174
174
|
]
|
|
175
175
|
},
|