@readme/markdown 13.1.4 → 13.3.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/dist/lib/mdast-util/legacy-variable/index.d.ts +2 -0
- package/dist/lib/mdxish.d.ts +2 -1
- package/dist/lib/micromark/legacy-variable/index.d.ts +4 -0
- package/dist/lib/micromark/legacy-variable/syntax.d.ts +10 -0
- package/dist/lib/plain.d.ts +6 -0
- package/dist/main.js +491 -200
- package/dist/main.node.js +491 -200
- package/dist/main.node.js.map +1 -1
- package/dist/processor/transform/mdxish/heading-slugs.d.ts +8 -0
- package/dist/processor/transform/mdxish/terminate-html-flow-blocks.d.ts +5 -5
- package/dist/processor/transform/mdxish/variables-code.d.ts +14 -0
- package/package.json +3 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Root } from 'hast';
|
|
2
|
+
/**
|
|
3
|
+
* Rehype plugin that constructs ids for headings
|
|
4
|
+
* Id's are used to construct slug anchor links & Table of Contents during rendering
|
|
5
|
+
* Use the text / nodes that make up the heading to generate the id
|
|
6
|
+
*/
|
|
7
|
+
declare const generateSlugForHeadings: () => (tree: Root) => Root;
|
|
8
|
+
export default generateSlugForHeadings;
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
* @link https://spec.commonmark.org/0.29/#html-blocks
|
|
10
10
|
*
|
|
11
11
|
* This preprocessor inserts a blank line after standalone HTML lines when the
|
|
12
|
-
* next line is non-blank
|
|
13
|
-
* and subsequent content is parsed independently.
|
|
12
|
+
* next line is non-blank and not an HTML construct (because they still might be part of the HTML flow),
|
|
13
|
+
* ensuring micromark's HTML flow tokenizer terminates and subsequent content is parsed independently.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
15
|
+
* Conditions:
|
|
16
|
+
* 1. Only targets non-indented lines with lowercase tag names. Uppercase tags
|
|
16
17
|
* (e.g., `<Table>`, `<MyComponent>`) are JSX custom components and don't
|
|
17
18
|
* trigger CommonMark HTML blocks, so they are left untouched.
|
|
18
|
-
*
|
|
19
|
-
* Lines inside fenced code blocks are skipped entirely.
|
|
19
|
+
* 2. Lines inside protected blocks (e.g., code blocks) should be left untouched.
|
|
20
20
|
*/
|
|
21
21
|
export declare function terminateHtmlFlowBlocks(content: string): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Variables } from '../../../types';
|
|
2
|
+
import type { Plugin } from 'unified';
|
|
3
|
+
interface Options {
|
|
4
|
+
variables?: Variables;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A remark mdast plugin that resolves legacy variables <<...>> and MDX variables {user.*} inside code and inline code nodes
|
|
8
|
+
* to their values. Uses regexes from the readme variable to search for variables in the code string.
|
|
9
|
+
*
|
|
10
|
+
* This is needed because variables in code blocks and inline cannot be tokenized, and also we need to maintain the code string
|
|
11
|
+
* in the code nodes. This enables engine side variable resolution in codes which improves UX
|
|
12
|
+
*/
|
|
13
|
+
declare const variablesCodeResolver: Plugin<[Options?]>;
|
|
14
|
+
export default variablesCodeResolver;
|
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.
|
|
5
|
+
"version": "13.3.0",
|
|
6
6
|
"main": "dist/main.node.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"browser": "dist/main.js",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"emoji-regex": "^10.2.1",
|
|
35
35
|
"estree-util-value-to-estree": "^3.1.1",
|
|
36
36
|
"gemoji": "^8.1.0",
|
|
37
|
+
"github-slugger": "^2.0.0",
|
|
37
38
|
"hast-util-from-html": "^2.0.1",
|
|
38
39
|
"hast-util-sanitize": "^4.0.0",
|
|
39
40
|
"hastscript": "^9.0.0",
|
|
@@ -162,7 +163,7 @@
|
|
|
162
163
|
},
|
|
163
164
|
{
|
|
164
165
|
"path": "dist/main.node.js",
|
|
165
|
-
"maxSize": "
|
|
166
|
+
"maxSize": "810KB"
|
|
166
167
|
}
|
|
167
168
|
]
|
|
168
169
|
},
|