myst-to-react 0.5.21 → 0.6.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.
- package/dist/admonitions.d.ts +2 -1
- package/dist/admonitions.d.ts.map +1 -1
- package/dist/admonitions.js +3 -3
- package/dist/basic.d.ts.map +1 -1
- package/dist/basic.js +7 -2
- package/dist/code.d.ts.map +1 -1
- package/dist/code.js +5 -0
- package/dist/crossReference.d.ts.map +1 -1
- package/dist/crossReference.js +1 -1
- package/dist/image.js +1 -1
- package/package.json +2 -2
package/dist/admonitions.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare enum AdmonitionKind {
|
|
|
16
16
|
}
|
|
17
17
|
type Color = 'blue' | 'green' | 'yellow' | 'red';
|
|
18
18
|
export declare const AdmonitionTitle: NodeRenderer<AdmonitionTitleSpec>;
|
|
19
|
-
export declare function Admonition({ title, kind, color, simple, dropdown, children, hideIcon, }: {
|
|
19
|
+
export declare function Admonition({ title, kind, color, simple, dropdown, children, hideIcon, className, }: {
|
|
20
20
|
title?: React.ReactNode;
|
|
21
21
|
color?: Color;
|
|
22
22
|
kind?: AdmonitionKind;
|
|
@@ -24,6 +24,7 @@ export declare function Admonition({ title, kind, color, simple, dropdown, child
|
|
|
24
24
|
simple?: boolean;
|
|
25
25
|
dropdown?: boolean;
|
|
26
26
|
hideIcon?: boolean;
|
|
27
|
+
className?: string;
|
|
27
28
|
}): import("react/jsx-runtime").JSX.Element;
|
|
28
29
|
export declare const AdmonitionRenderer: NodeRenderer<AdmonitionSpec>;
|
|
29
30
|
declare const ADMONITION_RENDERERS: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admonitions.d.ts","sourceRoot":"","sources":["../src/admonitions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,IAAI,cAAc,EAC5B,eAAe,IAAI,mBAAmB,EACvC,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,MAAM,OAAO,C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AM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,GACV,EAAE;IACD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,2CAsEA;AAED,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,cAAc,CAuB3D,CAAC;AAEF,QAAA,MAAM,oBAAoB;;;CAGzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
package/dist/admonitions.js
CHANGED
|
@@ -96,7 +96,7 @@ const HeaderElement = ({ dropdown, className, children, }) => {
|
|
|
96
96
|
return _jsx("summary", { className: className, children: children });
|
|
97
97
|
return _jsx("div", { className: className, children: children });
|
|
98
98
|
};
|
|
99
|
-
export function Admonition({ title, kind, color, simple, dropdown, children, hideIcon, }) {
|
|
99
|
+
export function Admonition({ title, kind, color, simple, dropdown, children, hideIcon, className, }) {
|
|
100
100
|
return (_jsxs(WrapperElement, { dropdown: dropdown, className: classNames('my-5 shadow-md dark:shadow-2xl dark:shadow-neutral-900', 'bg-gray-50/10 dark:bg-stone-800', 'overflow-hidden', {
|
|
101
101
|
'rounded border-l-4': !simple,
|
|
102
102
|
'border-l-2': simple,
|
|
@@ -104,7 +104,7 @@ export function Admonition({ title, kind, color, simple, dropdown, children, hid
|
|
|
104
104
|
'border-green-600': color === 'green',
|
|
105
105
|
'border-amber-600': color === 'yellow',
|
|
106
106
|
'border-red-600': color === 'red',
|
|
107
|
-
}), children: [title && (_jsxs(HeaderElement, { dropdown: dropdown, className: classNames('m-0 font-medium py-1 flex min-w-0', {
|
|
107
|
+
}, className), children: [title && (_jsxs(HeaderElement, { dropdown: dropdown, className: classNames('m-0 font-medium py-1 flex min-w-0', {
|
|
108
108
|
'text-lg': !simple,
|
|
109
109
|
'text-md': simple,
|
|
110
110
|
'bg-gray-100 dark:bg-stone-700': simple,
|
|
@@ -129,7 +129,7 @@ export const AdmonitionRenderer = ({ node }) => {
|
|
|
129
129
|
const isSimple = classes.includes('simple');
|
|
130
130
|
const hideIcon = node.icon === false;
|
|
131
131
|
const useTitle = (title === null || title === void 0 ? void 0 : title.type) === 'admonitionTitle';
|
|
132
|
-
return (_jsx(Admonition, { title: useTitle ? _jsx(MyST, { ast: [title] }) : undefined, kind: kind, color: color, dropdown: isDropdown, simple: isSimple, hideIcon: hideIcon, children: useTitle ? _jsx(MyST, { ast: rest }) : _jsx(MyST, { ast: node.children }) }));
|
|
132
|
+
return (_jsx(Admonition, { title: useTitle ? _jsx(MyST, { ast: [title] }) : undefined, kind: kind, color: color, dropdown: isDropdown, simple: isSimple, hideIcon: hideIcon, className: classNames(classes), children: useTitle ? _jsx(MyST, { ast: rest }) : _jsx(MyST, { ast: node.children }) }));
|
|
133
133
|
};
|
|
134
134
|
const ADMONITION_RENDERERS = {
|
|
135
135
|
admonition: AdmonitionRenderer,
|
package/dist/basic.d.ts.map
CHANGED
|
@@ -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,MAAM,GAAG;IACZ,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF,KAAK,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AAC;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,kBAqRtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/basic.js
CHANGED
|
@@ -103,9 +103,14 @@ const BASIC_RENDERERS = {
|
|
|
103
103
|
rowSpan: ifGreaterThanOne(node.rowspan),
|
|
104
104
|
colSpan: ifGreaterThanOne(node.colspan),
|
|
105
105
|
};
|
|
106
|
+
const align = {
|
|
107
|
+
'text-left': node.align === 'left',
|
|
108
|
+
'text-right': node.align === 'right',
|
|
109
|
+
'text-center': node.align === 'center',
|
|
110
|
+
};
|
|
106
111
|
if (node.header)
|
|
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 }) })));
|
|
112
|
+
return (_jsx("th", Object.assign({ className: classNames(node.class, align), style: node.style }, attrs, { children: _jsx(MyST, { ast: node.children }) })));
|
|
113
|
+
return (_jsx("td", Object.assign({ className: classNames(node.class, align), style: node.style }, attrs, { children: _jsx(MyST, { ast: node.children }) })));
|
|
109
114
|
},
|
|
110
115
|
subscript({ node }) {
|
|
111
116
|
return (_jsx("sub", { children: _jsx(MyST, { ast: node.children }) }));
|
package/dist/code.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../src/code.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../src/code.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAU1D,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAWF,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,2CA4ErC;AAuDD,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBArD0B,OAAO;;;CAwDpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/code.js
CHANGED
|
@@ -6,6 +6,7 @@ import dark from 'react-syntax-highlighter/dist/esm/styles/hljs/vs2015.js';
|
|
|
6
6
|
import { DocumentIcon } from '@heroicons/react/24/outline';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import { CopyIcon } from './components/index.js';
|
|
9
|
+
import { MyST } from './MyST.js';
|
|
9
10
|
function normalizeLanguage(lang) {
|
|
10
11
|
switch (lang) {
|
|
11
12
|
case 'html':
|
|
@@ -60,6 +61,10 @@ const inlineCode = ({ node }) => {
|
|
|
60
61
|
if (isColor(node.value)) {
|
|
61
62
|
return (_jsxs("code", { className: "px-1 rounded bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-100", children: [node.value, _jsx("span", { style: { backgroundColor: node.value }, className: "inline-block w-[10px] h-[10px] rounded-full ml-1" })] }));
|
|
62
63
|
}
|
|
64
|
+
if (node.children && node.children.length > 0) {
|
|
65
|
+
// The inline code can potentially have children
|
|
66
|
+
return (_jsx("code", { children: _jsx(MyST, { ast: node.children }) }));
|
|
67
|
+
}
|
|
63
68
|
return _jsx("code", { children: node.value });
|
|
64
69
|
};
|
|
65
70
|
const CODE_RENDERERS = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crossReference.d.ts","sourceRoot":"","sources":["../src/crossReference.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AA0H/B,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,GAAG,EACH,OAAO,GACR,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,sDAWA;AAuBD,wBAAgB,mBAAmB,CAAC,EAClC,GAAG,EAAE,KAAK,EACV,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,QAAQ,EAChB,QAAQ,EACR,UAAU,EACV,MAAW,GACZ,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,2CAuDA;AAED,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"crossReference.d.ts","sourceRoot":"","sources":["../src/crossReference.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AA0H/B,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,GAAG,EACH,OAAO,GACR,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,sDAWA;AAuBD,wBAAgB,mBAAmB,CAAC,EAClC,GAAG,EAAE,KAAK,EACV,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,QAAQ,EAChB,QAAQ,EACR,UAAU,EACV,MAAW,GACZ,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,2CAuDA;AAED,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,cAAc,CAuB3D,CAAC;AAEF,QAAA,MAAM,yBAAyB;;CAE9B,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
package/dist/crossReference.js
CHANGED
|
@@ -145,7 +145,7 @@ export const CrossReferenceNode = ({ node }) => {
|
|
|
145
145
|
return (_jsx(InlineError, { value: node.label || node.identifier || 'No Label', message: "Cross Reference Not Found" }));
|
|
146
146
|
}
|
|
147
147
|
const { remote, url, dataUrl, identifier, html_id } = node;
|
|
148
|
-
return (
|
|
148
|
+
return (_jsxs(CrossReferenceHover, { identifier: identifier, htmlId: html_id, remote: remote, url: url, dataUrl: dataUrl, children: [node.prefix && _jsxs(_Fragment, { children: [node.prefix, " "] }), _jsx(MyST, { ast: node.children }), node.suffix || null] }));
|
|
149
149
|
};
|
|
150
150
|
const CROSS_REFERENCE_RENDERERS = {
|
|
151
151
|
crossReference: CrossReferenceNode,
|
package/dist/image.js
CHANGED
|
@@ -37,7 +37,7 @@ function Video({ src, urlSource, align = 'center', width, height, }) {
|
|
|
37
37
|
muted: true, "webkit-playsinline": "true", playsInline: true, loop: true }));
|
|
38
38
|
}
|
|
39
39
|
function Picture({ src, srcOptimized, urlSource, align = 'center', alt, width, height, }) {
|
|
40
|
-
if (src.endsWith('.mp4')) {
|
|
40
|
+
if (src.endsWith('.mp4') || (urlSource === null || urlSource === void 0 ? void 0 : urlSource.endsWith('.mp4'))) {
|
|
41
41
|
return _jsx(Video, { width: width, height: height, align: align, src: src, urlSource: urlSource });
|
|
42
42
|
}
|
|
43
43
|
const image = (_jsx("img", { style: Object.assign({ width: getStyleValue(width), height: getStyleValue(height) }, alignToMargin(align)), src: src, alt: alt, "data-canonical-url": urlSource }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myst-to-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@heroicons/react": "^2.0.18",
|
|
24
|
-
"@myst-theme/providers": "^0.
|
|
24
|
+
"@myst-theme/providers": "^0.6.0",
|
|
25
25
|
"@radix-ui/react-hover-card": "^1.0.6",
|
|
26
26
|
"buffer": "^6.0.3",
|
|
27
27
|
"classnames": "^2.3.2",
|