@readme/markdown 13.2.0 → 13.4.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.
@@ -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;
@@ -21,6 +21,18 @@ export type JSXContext = Record<string, unknown>;
21
21
  * ```
22
22
  */
23
23
  export declare function evaluateExpression(expression: string, context: JSXContext): any;
24
+ /**
25
+ * Removes JSX-style comments (e.g., { /* comment *\/ }) from content.
26
+ *
27
+ * @param content
28
+ * @returns Content with JSX comments removed
29
+ * @example
30
+ * ```typescript
31
+ * removeJSXComments('Text { /* comment *\/ } more text')
32
+ * // Returns: 'Text more text'
33
+ * ```
34
+ */
35
+ export declare function removeJSXComments(content: string): string;
24
36
  /**
25
37
  * Preprocesses JSX-like expressions in markdown before parsing.
26
38
  * Inline expressions are handled separately; attribute expressions are processed here.
@@ -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;
@@ -1,7 +1,11 @@
1
1
  import type { Plugin } from 'unified';
2
2
  /**
3
- * A remark plugin that parses {user.<field>} patterns from text nodes
4
- * without requiring remarkMdx. Creates Variable nodes for runtime resolution.
3
+ * A remark plugin that parses {user.<field>} patterns from text nodes and
4
+ * mdxTextExpression nodes, creating Variable nodes for runtime resolution.
5
+ *
6
+ * Handles both:
7
+ * - `text` nodes: when safeMode is true or after expression evaluation
8
+ * - `mdxTextExpression` nodes: when mdxExpression has parsed {user.*} before evaluation
5
9
  *
6
10
  * Supports any user field: name, email, email_verified, exp, iat, etc.
7
11
  */
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.2.0",
5
+ "version": "13.4.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": "805KB"
166
+ "maxSize": "810KB"
166
167
  }
167
168
  ]
168
169
  },