@readme/markdown 14.5.0 → 14.7.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.
@@ -1,6 +1,19 @@
1
1
  import type { Transform } from 'mdast-util-from-markdown';
2
2
  /**
3
- * Transforms HTMLBlock MDX JSX to html-block nodes. Handles <HTMLBlock>{`...`}</HTMLBlock> syntax.
3
+ * Converts every `<HTMLBlock>` shape that survives parsing into the canonical
4
+ * `html-block` MDAST node, reading the body from the tokenizer's template-literal
5
+ * expression. Three shapes occur:
6
+ *
7
+ * 1. JSX element (`mdxJsxFlowElement`/`mdxJsxTextElement`) — multiline/block
8
+ * context and table cells (after their remarkMdx re-parse).
9
+ * 2. Raw `html` blob (`splitRawHtmlBlocks`) — single-line top-level, or nested
10
+ * in raw HTML like an inline `<div>`.
11
+ * 3. Inline-in-paragraph — split into `html` + expression + `html` siblings.
12
+ *
13
+ * Runs *after* `mdxishTables` so table cells are re-parsed first;
14
+ * `mdxishTables` recognizes the still-JSX `<HTMLBlock>` element when deciding to
15
+ * keep a table as a JSX `<Table>`. This replaces the old base64-comment marker
16
+ * machinery — the #1455 tokenizer hands the body over already parsed.
4
17
  */
5
18
  declare const mdxishHtmlBlocks: () => Transform;
6
19
  export default mdxishHtmlBlocks;
@@ -1,6 +1,3 @@
1
- export declare function base64Decode(str: string): string;
2
- export declare const HTML_BLOCK_CONTENT_START = "<!--RDMX_HTMLBLOCK:";
3
- export declare const HTML_BLOCK_CONTENT_END = ":RDMX_HTMLBLOCK-->";
4
1
  /**
5
2
  * Removes JSX-style comments (e.g., { /* comment *\/ }) from content.
6
3
  *
@@ -93,10 +93,12 @@ export declare const isMDXEsm: (node: Node) => node is MdxjsEsm;
93
93
  * Takes an HTML string and formats it for display in the editor. Removes leading/trailing newlines
94
94
  * and unindents the HTML.
95
95
  *
96
- * @param {string} html - HTML content from template literal
96
+ * @param {string} html - cooked HTML payload (callers strip any template-literal backticks first)
97
+ * @param {number} [openingTagIndent=0] - column the `<HTMLBlock>` opening tag sits at, used to
98
+ * dedent each content line so its indentation reads relative to the tag, not the line start
97
99
  * @returns {string} processed HTML
98
100
  */
99
- export declare function formatHtmlForMdxish(html: string): string;
101
+ export declare function formatHtmlForMdxish(html: string, openingTagIndent?: number): string;
100
102
  /**
101
103
  * Takes an HTML string and formats it for display in the editor. Removes leading/trailing newlines
102
104
  * and unindents the HTML.
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": "14.5.0",
5
+ "version": "14.7.0",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",
@@ -177,7 +177,7 @@
177
177
  },
178
178
  {
179
179
  "path": "dist/main.node.js",
180
- "maxSize": "947KB"
180
+ "maxSize": "950KB"
181
181
  }
182
182
  ]
183
183
  },
package/styles/gfm.scss CHANGED
@@ -277,6 +277,21 @@
277
277
  margin-top: 0;
278
278
  }
279
279
 
280
+ // no margins where we’ll likely have inline images or they might break layout
281
+ h1,
282
+ h2,
283
+ h3,
284
+ h4,
285
+ h5,
286
+ h6,
287
+ figcaption,
288
+ ol,
289
+ ul,
290
+ p,
291
+ table {
292
+ --markdown-img-margin: 0;
293
+ }
294
+
280
295
  ol,
281
296
  ul {
282
297
  margin-bottom: round(1.3333em, 1px); // 20px at 15px base (condensed)
package/types.d.ts CHANGED
@@ -143,6 +143,7 @@ export interface ImageBlockAttrs {
143
143
  src: string;
144
144
  title: string;
145
145
  width?: string;
146
+ wrap?: boolean;
146
147
  }
147
148
 
148
149
  export interface ImageBlock extends ImageBlockAttrs, Omit<Parent, 'children'> {