@readme/markdown 13.3.0 → 13.5.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,12 @@
1
+ import type { List, ListItem } from 'mdast';
2
+ import type { Info, State } from 'mdast-util-to-markdown';
3
+ /**
4
+ * List-item serializer intended for checklist items
5
+ * Uses the default listItem handler for formatting, then patches the output to inject the checkbox and preserve empty items
6
+ *
7
+ * The current aim is to ensure checklist items that have no text after the checkbox are serialized
8
+ * with their checkbox intact (for example, `- [ ]`) instead of dropping it
9
+ * We can add more adjustments if needed
10
+ */
11
+ declare const listItem: (node: ListItem, parent?: List, state?: State, info?: Info) => string;
12
+ export default listItem;
@@ -0,0 +1,13 @@
1
+ import type { Root } from 'hast';
2
+ import type { Transformer } from 'unified';
3
+ /**
4
+ * Rehype plugin that flattens paragraph elements that are adjacent to lists in table cells.
5
+ *
6
+ * When markdown content is parsed inside JSX table cells, text before/after lists
7
+ * gets wrapped in `<p>` tags. This causes unwanted spacing because both `<p>` and
8
+ * list elements have margins.
9
+ *
10
+ * This plugin selectively unwraps only `<p>` elements that are immediately before
11
+ * or after a list (`<ul>` or `<ol>`), preserving paragraphs in other contexts.
12
+ */
13
+ export declare const rehypeFlattenTableCellParagraphs: () => Transformer<Root, Root>;
@@ -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.
@@ -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.3.0",
5
+ "version": "13.5.0",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",
@@ -32,6 +32,7 @@
32
32
  "debug": "^4.3.4",
33
33
  "deepmerge": "^4.3.1",
34
34
  "emoji-regex": "^10.2.1",
35
+ "entities": "^4.5.0",
35
36
  "estree-util-value-to-estree": "^3.1.1",
36
37
  "gemoji": "^8.1.0",
37
38
  "github-slugger": "^2.0.0",
@@ -42,9 +43,11 @@
42
43
  "lodash.escape": "^4.0.1",
43
44
  "lodash.kebabcase": "^4.1.1",
44
45
  "mdast-util-find-and-replace": "^3.0.1",
46
+ "mdast-util-gfm-strikethrough": "^2.0.0",
45
47
  "mdast-util-mdx-expression": "2.0.0",
46
48
  "mdast-util-phrasing": "^4.1.0",
47
49
  "mdast-util-to-markdown": "^2.1.2",
50
+ "micromark-extension-gfm-strikethrough": "^2.1.0",
48
51
  "micromark-extension-mdx-expression": "^3.0.1",
49
52
  "micromark-util-character": "^2.1.1",
50
53
  "micromark-util-html-tag-name": "^2.0.1",
@@ -163,7 +166,7 @@
163
166
  },
164
167
  {
165
168
  "path": "dist/main.node.js",
166
- "maxSize": "810KB"
169
+ "maxSize": "825KB"
167
170
  }
168
171
  ]
169
172
  },