@readme/markdown 6.75.0-beta.59 → 6.75.0-beta.60

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.
@@ -13,8 +13,10 @@ const extractScripts = (html: string = ''): [string, () => void] => {
13
13
  return [cleaned, () => scripts.map(js => window.eval(js))];
14
14
  };
15
15
 
16
- const HTMLBlock = ({ children = '', runScripts = false, safeMode = false }) => {
16
+ const HTMLBlock = ({ children = '', runScripts, safeMode = false }) => {
17
17
  let html = children;
18
+ runScripts = typeof runScripts !== 'boolean' ? (runScripts === 'true' ? true : false) : runScripts;
19
+
18
20
  if (typeof html !== 'string') html = renderToStaticMarkup(html);
19
21
  const [cleanedHtml, exec] = extractScripts(html);
20
22
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  declare const HTMLBlock: ({ children, runScripts, safeMode }: {
3
3
  children?: string;
4
- runScripts?: boolean;
4
+ runScripts: any;
5
5
  safeMode?: boolean;
6
6
  }) => React.JSX.Element;
7
7
  export default HTMLBlock;
package/dist/main.js CHANGED
@@ -14398,8 +14398,9 @@ const extractScripts = (html = '') => {
14398
14398
  const cleaned = html.replace(MATCH_SCRIPT_TAGS, '');
14399
14399
  return [cleaned, () => scripts.map(js => window.eval(js))];
14400
14400
  };
14401
- const HTMLBlock = ({ children = '', runScripts = false, safeMode = false }) => {
14401
+ const HTMLBlock = ({ children = '', runScripts, safeMode = false }) => {
14402
14402
  let html = children;
14403
+ runScripts = typeof runScripts !== 'boolean' ? (runScripts === 'true' ? true : false) : runScripts;
14403
14404
  if (typeof html !== 'string')
14404
14405
  html = (0,server_browser/* renderToStaticMarkup */.qV)(html);
14405
14406
  const [cleanedHtml, exec] = extractScripts(html);
@@ -65576,29 +65577,121 @@ const injectComponents = (opts) => () => tree => {
65576
65577
  /* harmony default export */ const inject_components = (injectComponents);
65577
65578
 
65578
65579
  ;// CONCATENATED MODULE: ./processor/utils.ts
65580
+ /**
65581
+ * Formats the hProperties of a node as a string, so they can be compiled back into JSX/MDX.
65582
+ * This currently sets all the values to a string since we process/compile the MDX on the fly
65583
+ * through the editor, and it'll throw errors over malformed JSX. TODO: fix this.
65584
+ *
65585
+ * @template T
65586
+ * @param {Node} node
65587
+ * @returns {string} formatted hProperties as JSX attributes
65588
+ */
65579
65589
  const formatHProps = (node) => {
65580
65590
  const hProps = getHProps(node);
65581
65591
  const hPropKeys = getHPropKeys(node);
65582
65592
  return hPropKeys.map(key => `${key}="${hProps[key]}"`).join(' ');
65583
65593
  };
65594
+ /**
65595
+ * Returns the hProperties of a node.
65596
+ *
65597
+ * @template T
65598
+ * @param {Node} node
65599
+ * @returns {T} hProperties
65600
+ */
65584
65601
  const getHProps = (node) => {
65585
65602
  var _a;
65586
65603
  const hProps = ((_a = node.data) === null || _a === void 0 ? void 0 : _a.hProperties) || {};
65587
65604
  return hProps;
65588
65605
  };
65606
+ /**
65607
+ * Returns array of hProperty keys.
65608
+ *
65609
+ * @template T
65610
+ * @param {Node} node
65611
+ * @returns {Array} array of hProperty keys
65612
+ */
65589
65613
  const getHPropKeys = (node) => {
65590
65614
  const hProps = getHProps(node);
65591
65615
  return Object.keys(hProps) || [];
65592
65616
  };
65617
+ /**
65618
+ * Gets the attributes of an MDX element and returns them as an object of hProperties.
65619
+ *
65620
+ * @template T
65621
+ * @param {(MdxJsxFlowElement | MdxJsxTextElement)} jsx
65622
+ * @returns {T} object of hProperties
65623
+ */
65593
65624
  const getAttrs = (jsx) => jsx.attributes.reduce((memo, attr) => {
65594
65625
  if ('name' in attr) {
65595
65626
  memo[attr.name] = attr.value;
65596
65627
  }
65597
65628
  return memo;
65598
65629
  }, {});
65630
+ /**
65631
+ * Gets the children of an MDX element and returns them as an array of Text nodes.
65632
+ * Currently only being used by the HTML Block component, which only expects a single text node.
65633
+ *
65634
+ * @template T
65635
+ * @param {(MdxJsxFlowElement | MdxJsxTextElement)} jsx
65636
+ * @returns {Array} array of child text nodes
65637
+ */
65638
+ const getChildren = (jsx) => jsx.children.reduce((memo, child, i) => {
65639
+ memo[i] = {
65640
+ type: 'text',
65641
+ value: child.value,
65642
+ position: child.position,
65643
+ };
65644
+ return memo;
65645
+ }, []);
65646
+ /**
65647
+ * Tests if a node is an MDX element.
65648
+ * TODO: Make this more extensible to all types of nodes. isElement(node, 'type' or ['type1', 'type2']), say
65649
+ *
65650
+ * @param {Node} node
65651
+ * @returns {(node is MdxJsxFlowElement | MdxJsxTextElement)}
65652
+ */
65599
65653
  const isMDXElement = (node) => {
65600
65654
  return ['mdxJsxFlowElement', 'mdxJsxTextElement'].includes(node.type);
65601
65655
  };
65656
+ /**
65657
+ * Takes an HTML string and formats it for display in the editor. Removes leading/trailing newlines
65658
+ * and unindents the HTML.
65659
+ *
65660
+ * @param {string} html
65661
+ * @returns {string} formatted HTML
65662
+ */
65663
+ const formatHTML = (html) => {
65664
+ // Remove leading/trailing backticks if present, since they're used to keep the HTML
65665
+ // from being parsed prematurely
65666
+ if (html.startsWith('`') && html.endsWith('`')) {
65667
+ html = html.slice(1, -1);
65668
+ }
65669
+ // Removes the leading/trailing newlines
65670
+ const cleaned = html.replace(/^\s*\n|\n\s*$/g, '');
65671
+ // // Get the number of spaces in the first line to determine the tab size
65672
+ // const tab = cleaned.match(/^\s*/)[0].length;
65673
+ // // Remove the first indentation level from each line
65674
+ // const tabRegex = new RegExp(`^\\s{${tab}}`, 'gm');
65675
+ // const unindented = cleaned.replace(tabRegex, '');
65676
+ return cleaned;
65677
+ };
65678
+ /**
65679
+ * Reformat HTML for the markdown/mdx by adding an indentation to each line. This assures that the
65680
+ * HTML is indentend properly within the HTMLBlock component when rendered in the markdown/mdx.
65681
+ *
65682
+ * @param {string} html
65683
+ * @param {number} [indent=2]
65684
+ * @returns {string} re-formatted HTML
65685
+ */
65686
+ const reformatHTML = (html, indent = 2) => {
65687
+ // Remove leading/trailing newlines
65688
+ const cleaned = html.replace(/^\s*\n|\n\s*$/g, '');
65689
+ // // Create a tab/indent with the specified number of spaces
65690
+ // const tab = ' '.repeat(indent);
65691
+ // // Indent each line of the HTML (converts to an array, indents each line, then joins back)
65692
+ // const indented = cleaned.split('\n').map((line: string) => `${tab}${line}`).join('\n');
65693
+ return cleaned;
65694
+ };
65602
65695
 
65603
65696
  ;// CONCATENATED MODULE: ./processor/transform/readme-components.ts
65604
65697
 
@@ -65611,6 +65704,7 @@ const readme_components_types = {
65611
65704
  EmbedBlock: NodeTypes['embed-block'],
65612
65705
  Glossary: NodeTypes['glossary'],
65613
65706
  ImageBlock: NodeTypes['image-block'],
65707
+ HTMLBlock: NodeTypes.htmlBlock,
65614
65708
  Table: 'table',
65615
65709
  Variable: NodeTypes['variable'],
65616
65710
  td: 'tableCell',
@@ -65652,6 +65746,22 @@ const coerceJsxToMd = ({ components = {} } = {}) => (node, index, parent) => {
65652
65746
  };
65653
65747
  parent.children[index] = mdNode;
65654
65748
  }
65749
+ else if (node.name === 'HTMLBlock') {
65750
+ const { position } = node;
65751
+ const children = getChildren(node);
65752
+ const { runScripts } = getAttrs(node);
65753
+ const html = formatHTML(children.map(({ value }) => value).join(''));
65754
+ const mdNode = {
65755
+ position,
65756
+ children: [{ type: 'text', value: html }],
65757
+ type: NodeTypes.htmlBlock,
65758
+ data: {
65759
+ hName: 'html-block',
65760
+ hProperties: Object.assign(Object.assign({}, (runScripts && { runScripts })), { html }),
65761
+ },
65762
+ };
65763
+ parent.children[index] = mdNode;
65764
+ }
65655
65765
  else if (node.name === 'Table') {
65656
65766
  const { children, position } = node;
65657
65767
  const { align = [...new Array(node.children.length)].map(() => null) } = getAttrs(node);
@@ -93460,11 +93570,12 @@ const gemoji_gemoji = (node) => `:${node.name}:`;
93460
93570
  /* harmony default export */ const compile_gemoji = (gemoji_gemoji);
93461
93571
 
93462
93572
  ;// CONCATENATED MODULE: ./processor/compile/html-block.ts
93573
+
93463
93574
  const htmlBlock = (node) => {
93464
- var _a;
93465
- const html = node.data.hProperties.html;
93466
- const attributes = Object.keys((_a = node.data) === null || _a === void 0 ? void 0 : _a.hProperties).map(key => { var _a; return `${key}="${(_a = node.data) === null || _a === void 0 ? void 0 : _a.hProperties[key]}"`; }).join(' ');
93467
- return `<HTMLBlock${attributes && ' ' + attributes}>{\`${html}\`}</HTMLBlock>`;
93575
+ const { runScripts, html } = getHProps(node);
93576
+ return `<HTMLBlock${runScripts != null ? ` runScripts="${runScripts}"` : ''}>{\`
93577
+ ${reformatHTML(html)}
93578
+ \`}</HTMLBlock>`;
93468
93579
  };
93469
93580
  /* harmony default export */ const html_block = (htmlBlock);
93470
93581
 
@@ -94471,7 +94582,7 @@ const makeUseMDXComponents = (more = {}) => {
94471
94582
  map[`h${index + 1}`] = components_Heading((index + 1));
94472
94583
  return map;
94473
94584
  }, {});
94474
- const components = Object.assign(Object.assign(Object.assign(Object.assign({}, components_namespaceObject), { Variable: (variable_default()), code: components_Code, embed: components_Embed, img: components_Image, table: components_Table, 'code-tabs': components_CodeTabs, 'html-block': components_HTMLBlock, 'embed-block': components_Embed, 'image-block': components_Image, 'table-of-contents': components_TableOfContents }), headings), more);
94585
+ const components = Object.assign(Object.assign(Object.assign(Object.assign({}, components_namespaceObject), { Variable: (variable_default()), code: components_Code, embed: components_Embed, img: components_Image, table: components_Table, 'code-tabs': components_CodeTabs, 'embed-block': components_Embed, 'html-block': components_HTMLBlock, 'image-block': components_Image, 'table-of-contents': components_TableOfContents }), headings), more);
94475
94586
  return () => components;
94476
94587
  };
94477
94588
  const run_run = async (string, _opts = {}) => {
package/dist/main.node.js CHANGED
@@ -14288,8 +14288,9 @@ const extractScripts = (html = '') => {
14288
14288
  const cleaned = html.replace(MATCH_SCRIPT_TAGS, '');
14289
14289
  return [cleaned, () => scripts.map(js => window.eval(js))];
14290
14290
  };
14291
- const HTMLBlock = ({ children = '', runScripts = false, safeMode = false }) => {
14291
+ const HTMLBlock = ({ children = '', runScripts, safeMode = false }) => {
14292
14292
  let html = children;
14293
+ runScripts = typeof runScripts !== 'boolean' ? (runScripts === 'true' ? true : false) : runScripts;
14293
14294
  if (typeof html !== 'string')
14294
14295
  html = (0,server_namespaceObject.renderToStaticMarkup)(html);
14295
14296
  const [cleanedHtml, exec] = extractScripts(html);
@@ -67029,29 +67030,121 @@ const injectComponents = (opts) => () => tree => {
67029
67030
  /* harmony default export */ const inject_components = (injectComponents);
67030
67031
 
67031
67032
  ;// CONCATENATED MODULE: ./processor/utils.ts
67033
+ /**
67034
+ * Formats the hProperties of a node as a string, so they can be compiled back into JSX/MDX.
67035
+ * This currently sets all the values to a string since we process/compile the MDX on the fly
67036
+ * through the editor, and it'll throw errors over malformed JSX. TODO: fix this.
67037
+ *
67038
+ * @template T
67039
+ * @param {Node} node
67040
+ * @returns {string} formatted hProperties as JSX attributes
67041
+ */
67032
67042
  const formatHProps = (node) => {
67033
67043
  const hProps = getHProps(node);
67034
67044
  const hPropKeys = getHPropKeys(node);
67035
67045
  return hPropKeys.map(key => `${key}="${hProps[key]}"`).join(' ');
67036
67046
  };
67047
+ /**
67048
+ * Returns the hProperties of a node.
67049
+ *
67050
+ * @template T
67051
+ * @param {Node} node
67052
+ * @returns {T} hProperties
67053
+ */
67037
67054
  const getHProps = (node) => {
67038
67055
  var _a;
67039
67056
  const hProps = ((_a = node.data) === null || _a === void 0 ? void 0 : _a.hProperties) || {};
67040
67057
  return hProps;
67041
67058
  };
67059
+ /**
67060
+ * Returns array of hProperty keys.
67061
+ *
67062
+ * @template T
67063
+ * @param {Node} node
67064
+ * @returns {Array} array of hProperty keys
67065
+ */
67042
67066
  const getHPropKeys = (node) => {
67043
67067
  const hProps = getHProps(node);
67044
67068
  return Object.keys(hProps) || [];
67045
67069
  };
67070
+ /**
67071
+ * Gets the attributes of an MDX element and returns them as an object of hProperties.
67072
+ *
67073
+ * @template T
67074
+ * @param {(MdxJsxFlowElement | MdxJsxTextElement)} jsx
67075
+ * @returns {T} object of hProperties
67076
+ */
67046
67077
  const getAttrs = (jsx) => jsx.attributes.reduce((memo, attr) => {
67047
67078
  if ('name' in attr) {
67048
67079
  memo[attr.name] = attr.value;
67049
67080
  }
67050
67081
  return memo;
67051
67082
  }, {});
67083
+ /**
67084
+ * Gets the children of an MDX element and returns them as an array of Text nodes.
67085
+ * Currently only being used by the HTML Block component, which only expects a single text node.
67086
+ *
67087
+ * @template T
67088
+ * @param {(MdxJsxFlowElement | MdxJsxTextElement)} jsx
67089
+ * @returns {Array} array of child text nodes
67090
+ */
67091
+ const utils_getChildren = (jsx) => jsx.children.reduce((memo, child, i) => {
67092
+ memo[i] = {
67093
+ type: 'text',
67094
+ value: child.value,
67095
+ position: child.position,
67096
+ };
67097
+ return memo;
67098
+ }, []);
67099
+ /**
67100
+ * Tests if a node is an MDX element.
67101
+ * TODO: Make this more extensible to all types of nodes. isElement(node, 'type' or ['type1', 'type2']), say
67102
+ *
67103
+ * @param {Node} node
67104
+ * @returns {(node is MdxJsxFlowElement | MdxJsxTextElement)}
67105
+ */
67052
67106
  const isMDXElement = (node) => {
67053
67107
  return ['mdxJsxFlowElement', 'mdxJsxTextElement'].includes(node.type);
67054
67108
  };
67109
+ /**
67110
+ * Takes an HTML string and formats it for display in the editor. Removes leading/trailing newlines
67111
+ * and unindents the HTML.
67112
+ *
67113
+ * @param {string} html
67114
+ * @returns {string} formatted HTML
67115
+ */
67116
+ const formatHTML = (html) => {
67117
+ // Remove leading/trailing backticks if present, since they're used to keep the HTML
67118
+ // from being parsed prematurely
67119
+ if (html.startsWith('`') && html.endsWith('`')) {
67120
+ html = html.slice(1, -1);
67121
+ }
67122
+ // Removes the leading/trailing newlines
67123
+ const cleaned = html.replace(/^\s*\n|\n\s*$/g, '');
67124
+ // // Get the number of spaces in the first line to determine the tab size
67125
+ // const tab = cleaned.match(/^\s*/)[0].length;
67126
+ // // Remove the first indentation level from each line
67127
+ // const tabRegex = new RegExp(`^\\s{${tab}}`, 'gm');
67128
+ // const unindented = cleaned.replace(tabRegex, '');
67129
+ return cleaned;
67130
+ };
67131
+ /**
67132
+ * Reformat HTML for the markdown/mdx by adding an indentation to each line. This assures that the
67133
+ * HTML is indentend properly within the HTMLBlock component when rendered in the markdown/mdx.
67134
+ *
67135
+ * @param {string} html
67136
+ * @param {number} [indent=2]
67137
+ * @returns {string} re-formatted HTML
67138
+ */
67139
+ const reformatHTML = (html, indent = 2) => {
67140
+ // Remove leading/trailing newlines
67141
+ const cleaned = html.replace(/^\s*\n|\n\s*$/g, '');
67142
+ // // Create a tab/indent with the specified number of spaces
67143
+ // const tab = ' '.repeat(indent);
67144
+ // // Indent each line of the HTML (converts to an array, indents each line, then joins back)
67145
+ // const indented = cleaned.split('\n').map((line: string) => `${tab}${line}`).join('\n');
67146
+ return cleaned;
67147
+ };
67055
67148
 
67056
67149
  ;// CONCATENATED MODULE: ./processor/transform/readme-components.ts
67057
67150
 
@@ -67064,6 +67157,7 @@ const readme_components_types = {
67064
67157
  EmbedBlock: NodeTypes['embed-block'],
67065
67158
  Glossary: NodeTypes['glossary'],
67066
67159
  ImageBlock: NodeTypes['image-block'],
67160
+ HTMLBlock: NodeTypes.htmlBlock,
67067
67161
  Table: 'table',
67068
67162
  Variable: NodeTypes['variable'],
67069
67163
  td: 'tableCell',
@@ -67105,6 +67199,22 @@ const coerceJsxToMd = ({ components = {} } = {}) => (node, index, parent) => {
67105
67199
  };
67106
67200
  parent.children[index] = mdNode;
67107
67201
  }
67202
+ else if (node.name === 'HTMLBlock') {
67203
+ const { position } = node;
67204
+ const children = utils_getChildren(node);
67205
+ const { runScripts } = getAttrs(node);
67206
+ const html = formatHTML(children.map(({ value }) => value).join(''));
67207
+ const mdNode = {
67208
+ position,
67209
+ children: [{ type: 'text', value: html }],
67210
+ type: NodeTypes.htmlBlock,
67211
+ data: {
67212
+ hName: 'html-block',
67213
+ hProperties: Object.assign(Object.assign({}, (runScripts && { runScripts })), { html }),
67214
+ },
67215
+ };
67216
+ parent.children[index] = mdNode;
67217
+ }
67108
67218
  else if (node.name === 'Table') {
67109
67219
  const { children, position } = node;
67110
67220
  const { align = [...new Array(node.children.length)].map(() => null) } = getAttrs(node);
@@ -94913,11 +95023,12 @@ const gemoji_gemoji = (node) => `:${node.name}:`;
94913
95023
  /* harmony default export */ const compile_gemoji = (gemoji_gemoji);
94914
95024
 
94915
95025
  ;// CONCATENATED MODULE: ./processor/compile/html-block.ts
95026
+
94916
95027
  const htmlBlock = (node) => {
94917
- var _a;
94918
- const html = node.data.hProperties.html;
94919
- const attributes = Object.keys((_a = node.data) === null || _a === void 0 ? void 0 : _a.hProperties).map(key => { var _a; return `${key}="${(_a = node.data) === null || _a === void 0 ? void 0 : _a.hProperties[key]}"`; }).join(' ');
94920
- return `<HTMLBlock${attributes && ' ' + attributes}>{\`${html}\`}</HTMLBlock>`;
95028
+ const { runScripts, html } = getHProps(node);
95029
+ return `<HTMLBlock${runScripts != null ? ` runScripts="${runScripts}"` : ''}>{\`
95030
+ ${reformatHTML(html)}
95031
+ \`}</HTMLBlock>`;
94921
95032
  };
94922
95033
  /* harmony default export */ const html_block = (htmlBlock);
94923
95034
 
@@ -95924,7 +96035,7 @@ const makeUseMDXComponents = (more = {}) => {
95924
96035
  map[`h${index + 1}`] = components_Heading((index + 1));
95925
96036
  return map;
95926
96037
  }, {});
95927
- const components = Object.assign(Object.assign(Object.assign(Object.assign({}, components_namespaceObject), { Variable: (dist_default()), code: components_Code, embed: components_Embed, img: components_Image, table: components_Table, 'code-tabs': components_CodeTabs, 'html-block': components_HTMLBlock, 'embed-block': components_Embed, 'image-block': components_Image, 'table-of-contents': components_TableOfContents }), headings), more);
96038
+ const components = Object.assign(Object.assign(Object.assign(Object.assign({}, components_namespaceObject), { Variable: (dist_default()), code: components_Code, embed: components_Embed, img: components_Image, table: components_Table, 'code-tabs': components_CodeTabs, 'embed-block': components_Embed, 'html-block': components_HTMLBlock, 'image-block': components_Image, 'table-of-contents': components_TableOfContents }), headings), more);
95928
96039
  return () => components;
95929
96040
  };
95930
96041
  const run_run = async (string, _opts = {}) => {
@@ -1,7 +1,70 @@
1
1
  import { Node } from 'mdast';
2
2
  import { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx';
3
- export declare const formatHProps: <T>(node: Node) => T;
3
+ /**
4
+ * Formats the hProperties of a node as a string, so they can be compiled back into JSX/MDX.
5
+ * This currently sets all the values to a string since we process/compile the MDX on the fly
6
+ * through the editor, and it'll throw errors over malformed JSX. TODO: fix this.
7
+ *
8
+ * @template T
9
+ * @param {Node} node
10
+ * @returns {string} formatted hProperties as JSX attributes
11
+ */
12
+ export declare const formatHProps: <T>(node: Node) => string;
13
+ /**
14
+ * Returns the hProperties of a node.
15
+ *
16
+ * @template T
17
+ * @param {Node} node
18
+ * @returns {T} hProperties
19
+ */
4
20
  export declare const getHProps: <T>(node: Node) => T;
5
- export declare const getHPropKeys: <T>(node: Node) => string[] | T;
6
- export declare const getAttrs: <T>(jsx: MdxJsxFlowElement | MdxJsxTextElement) => T;
21
+ /**
22
+ * Returns array of hProperty keys.
23
+ *
24
+ * @template T
25
+ * @param {Node} node
26
+ * @returns {Array} array of hProperty keys
27
+ */
28
+ export declare const getHPropKeys: <T>(node: Node) => any;
29
+ /**
30
+ * Gets the attributes of an MDX element and returns them as an object of hProperties.
31
+ *
32
+ * @template T
33
+ * @param {(MdxJsxFlowElement | MdxJsxTextElement)} jsx
34
+ * @returns {T} object of hProperties
35
+ */
36
+ export declare const getAttrs: <T>(jsx: MdxJsxFlowElement | MdxJsxTextElement) => any;
37
+ /**
38
+ * Gets the children of an MDX element and returns them as an array of Text nodes.
39
+ * Currently only being used by the HTML Block component, which only expects a single text node.
40
+ *
41
+ * @template T
42
+ * @param {(MdxJsxFlowElement | MdxJsxTextElement)} jsx
43
+ * @returns {Array} array of child text nodes
44
+ */
45
+ export declare const getChildren: <T>(jsx: MdxJsxFlowElement | MdxJsxTextElement) => any;
46
+ /**
47
+ * Tests if a node is an MDX element.
48
+ * TODO: Make this more extensible to all types of nodes. isElement(node, 'type' or ['type1', 'type2']), say
49
+ *
50
+ * @param {Node} node
51
+ * @returns {(node is MdxJsxFlowElement | MdxJsxTextElement)}
52
+ */
7
53
  export declare const isMDXElement: (node: Node) => node is MdxJsxFlowElement | MdxJsxTextElement;
54
+ /**
55
+ * Takes an HTML string and formats it for display in the editor. Removes leading/trailing newlines
56
+ * and unindents the HTML.
57
+ *
58
+ * @param {string} html
59
+ * @returns {string} formatted HTML
60
+ */
61
+ export declare const formatHTML: (html: string) => string;
62
+ /**
63
+ * Reformat HTML for the markdown/mdx by adding an indentation to each line. This assures that the
64
+ * HTML is indentend properly within the HTMLBlock component when rendered in the markdown/mdx.
65
+ *
66
+ * @param {string} html
67
+ * @param {number} [indent=2]
68
+ * @returns {string} re-formatted HTML
69
+ */
70
+ export declare const reformatHTML: (html: string, indent?: number) => string;
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": "6.75.0-beta.59",
5
+ "version": "6.75.0-beta.60",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",