myst-to-react 0.5.16 → 0.5.18

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/MyST.js CHANGED
@@ -6,12 +6,12 @@ function DefaultComponent({ node }) {
6
6
  return (_jsx("div", { children: _jsx(MyST, { ast: node.children }) }));
7
7
  }
8
8
  export function MyST({ ast }) {
9
- var _a;
9
+ var _a, _b;
10
10
  const renderers = useNodeRenderers();
11
11
  if (!ast || ast.length === 0)
12
12
  return null;
13
13
  if (!Array.isArray(ast)) {
14
- const Component = (_a = renderers[ast.type]) !== null && _a !== void 0 ? _a : DefaultComponent;
14
+ const Component = (_b = (_a = renderers[ast.type]) !== null && _a !== void 0 ? _a : renderers['DefaultComponent']) !== null && _b !== void 0 ? _b : DefaultComponent;
15
15
  return _jsx(Component, { node: ast }, ast.key);
16
16
  }
17
17
  return (_jsx(_Fragment, { children: ast === null || ast === void 0 ? void 0 : ast.map((node) => {
package/dist/basic.d.ts CHANGED
@@ -46,6 +46,7 @@ type BasicNodeRenderers = {
46
46
  }>;
47
47
  container: NodeRenderer<spec.Container>;
48
48
  caption: NodeRenderer<spec.Caption>;
49
+ legend: NodeRenderer<spec.Legend>;
49
50
  blockquote: NodeRenderer<spec.Blockquote>;
50
51
  thematicBreak: NodeRenderer<spec.ThematicBreak>;
51
52
  subscript: NodeRenderer<spec.Subscript>;
@@ -1 +1 @@
1
- {"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../src/basic.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,KAAK,SAAS,GAAG;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,MA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,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,WAAW,EAAE,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAExC,aAAa,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IAC3C,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACnC,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAEnC,cAAc,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAC7C,cAAc,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAC7C,qBAAqB,EAAE,YAAY,CAAC,qBAAqB,CAAC,CAAC;CAC5D,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,kBAgRtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
package/dist/basic.js CHANGED
@@ -77,6 +77,9 @@ const BASIC_RENDERERS = {
77
77
  caption({ node }) {
78
78
  return (_jsx("figcaption", { className: "group", children: _jsx(MyST, { ast: node.children }) }));
79
79
  },
80
+ legend({ node }) {
81
+ return (_jsx("figcaption", { className: "text-sm", children: _jsx(MyST, { ast: node.children }) }));
82
+ },
80
83
  blockquote({ node }) {
81
84
  return (_jsx("blockquote", { id: node.html_id, children: _jsx(MyST, { ast: node.children }) }));
82
85
  },
@@ -89,10 +92,10 @@ const BASIC_RENDERERS = {
89
92
  },
90
93
  table({ node }) {
91
94
  // TODO: actually render the tbody on the server if it isn't included here.
92
- return (_jsx("table", { children: _jsx("tbody", { children: _jsx(MyST, { ast: node.children }) }) }));
95
+ return (_jsx("table", { className: node.class, style: node.style, children: _jsx("tbody", { children: _jsx(MyST, { ast: node.children }) }) }));
93
96
  },
94
97
  tableRow({ node }) {
95
- return (_jsx("tr", { children: _jsx(MyST, { ast: node.children }) }));
98
+ return (_jsx("tr", { className: node.class, style: node.style, children: _jsx(MyST, { ast: node.children }) }));
96
99
  },
97
100
  tableCell({ node }) {
98
101
  const ifGreaterThanOne = (num) => (num === 1 ? undefined : num);
@@ -101,8 +104,8 @@ const BASIC_RENDERERS = {
101
104
  colSpan: ifGreaterThanOne(node.colspan),
102
105
  };
103
106
  if (node.header)
104
- return (_jsx("th", Object.assign({}, attrs, { children: _jsx(MyST, { ast: node.children }) })));
105
- return (_jsx("td", Object.assign({}, attrs, { children: _jsx(MyST, { ast: node.children }) })));
107
+ return (_jsx("th", Object.assign({ className: node.class, style: node.style }, attrs, { children: _jsx(MyST, { ast: node.children }) })));
108
+ return (_jsx("td", Object.assign({ className: node.class, style: node.style }, attrs, { children: _jsx(MyST, { ast: node.children }) })));
106
109
  },
107
110
  subscript({ node }) {
108
111
  return (_jsx("sub", { children: _jsx(MyST, { ast: node.children }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myst-to-react",
3
- "version": "0.5.16",
3
+ "version": "0.5.18",
4
4
  "type": "module",
5
5
  "exports": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,12 +21,12 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@heroicons/react": "^2.0.18",
24
- "@myst-theme/providers": "^0.5.16",
24
+ "@myst-theme/providers": "^0.5.18",
25
25
  "@radix-ui/react-hover-card": "^1.0.6",
26
26
  "buffer": "^6.0.3",
27
27
  "classnames": "^2.3.2",
28
- "myst-common": "^1.1.16",
29
- "myst-config": "^1.1.16",
28
+ "myst-common": "^1.1.18",
29
+ "myst-config": "^1.1.18",
30
30
  "myst-spec": "^0.0.4",
31
31
  "nanoid": "^4.0.2",
32
32
  "react-syntax-highlighter": "^15.5.0",