@readme/markdown 13.8.4 → 14.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.
@@ -38,7 +38,7 @@ declare const _default: ((({ isMdxish }?: {
38
38
  isMdxish?: boolean;
39
39
  }) => (tree: import("mdast").Root) => void) | (({ copyButtons }?: {
40
40
  copyButtons?: boolean;
41
- }) => (tree: import("mdast").Node) => import("mdast").Node) | (() => (tree: import("mdast").Node) => void) | (() => (tree: import("mdast").Root) => import("mdast").Root) | (({ isMdxish }?: {
41
+ }) => (tree: import("mdast").Node) => import("mdast").Node) | (() => (tree: import("mdast").Node) => void) | (({ isMdxish }?: {
42
42
  isMdxish?: boolean;
43
- }) => (tree: import("mdast").Node) => import("mdast").Node))[];
43
+ }) => (tree: import("mdast").Node) => import("mdast").Node) | (() => (tree: import("mdast").Root) => import("mdast").Root))[];
44
44
  export default _default;
@@ -6,6 +6,16 @@ import type { Plugin } from 'unified';
6
6
  * Handles both key-value attributes (theme="info") and boolean attributes (empty).
7
7
  */
8
8
  export declare const parseAttributes: (raw: string) => MdxJsxAttribute[];
9
+ /**
10
+ * Parse an HTML tag string into structured data.
11
+ */
12
+ export declare const parseTag: (value: string) => {
13
+ tag: string;
14
+ attributes: MdxJsxAttribute[];
15
+ selfClosing: boolean;
16
+ contentAfterTag: string;
17
+ attrString: string;
18
+ };
9
19
  /**
10
20
  * Transform PascalCase HTML nodes into mdxJsxFlowElement nodes.
11
21
  *
@@ -13,9 +23,9 @@ export declare const parseAttributes: (raw: string) => MdxJsxAttribute[];
13
23
  * These are the custom readme MDX syntax for components.
14
24
  * This transformer identifies these patterns and converts them to proper MDX JSX elements so they
15
25
  * can be accurately recognized and rendered later with their component definition code.
16
- * Though for some tags, we need to handle them specially
17
26
  *
18
- * ## Supported HTML Structures
27
+ * The mdx-component micromark tokenizer ensures that multi-line components are captured
28
+ * as single HTML nodes, so this transformer only needs to handle two cases:
19
29
  *
20
30
  * ### 1. Self-closing tags
21
31
  * ```
@@ -25,45 +35,13 @@ export declare const parseAttributes: (raw: string) => MdxJsxAttribute[];
25
35
  *
26
36
  * ### 2. Self-contained blocks (entire component in single HTML node)
27
37
  * ```
28
- * <Button>Click me</Button>
29
- * ```
30
- * ```
31
38
  * <Component>
32
- * <h2>Title</h2>
33
- * <p>Content</p>
39
+ * content
34
40
  * </Component>
35
41
  * ```
36
- * Parsed as: `html: "<Component>\n <h2>Title</h2>\n <p>Content</p>\n</Component>"`
37
- * The opening tag, content, and closing tag are all captured in one HTML node.
38
- *
39
- * ### 3. Multi-sibling components (closing tag in a following sibling)
40
- * Handles various structures where the closing tag is in a later sibling, such as:
41
- *
42
- * #### 3a. Block components (closing tag in sibling paragraph)
43
- * ```
44
- * <Callout>
45
- * Some **markdown** content
46
- * </Callout>
47
- * ```
48
- *
49
- * #### 3b. Multi-paragraph components (closing tag several siblings away)
50
- * ```
51
- * <Callout>
52
- *
53
- * First paragraph
54
- *
55
- * Second paragraph
56
- * </Callout>
57
- * ```
58
- *
59
- * #### 3c. Nested components split by blank lines (closing tag embedded in HTML sibling)
60
- * ```
61
- * <Outer>
62
- * <Inner>content</Inner>
63
- *
64
- * <Inner>content</Inner>
65
- * </Outer>
66
- * ```
42
+ * Parsed as: `html: "<Component>\n content\n</Component>"`
43
+ * The opening tag, content, and closing tag are all captured in one HTML node
44
+ * (guaranteed by the mdx-component tokenizer).
67
45
  */
68
46
  declare const mdxishComponentBlocks: Plugin<[], Parent>;
69
47
  export default mdxishComponentBlocks;
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.8.4",
5
+ "version": "14.0.0",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",
package/styles/gfm.scss CHANGED
@@ -209,14 +209,14 @@
209
209
 
210
210
  ol ol,
211
211
  ul ol {
212
- list-style-type: lower-roman;
212
+ list-style-type: lower-alpha;
213
213
  }
214
214
 
215
215
  ol ol ol,
216
216
  ol ul ol,
217
217
  ul ol ol,
218
218
  ul ul ol {
219
- list-style-type: lower-alpha;
219
+ list-style-type: lower-roman;
220
220
  }
221
221
 
222
222
  dd {
@@ -1,5 +0,0 @@
1
- /**
2
- * Inline component tags handled by mdxish-inline-components.ts.
3
- * Also excluded from block-level handling in mdxish-component-blocks.ts.
4
- */
5
- export declare const INLINE_COMPONENT_TAGS: Set<string>;