@readme/markdown 8.3.0 → 8.4.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,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
import { tailwindPrefix } from '../../utils/consts';
|
|
4
|
+
|
|
3
5
|
interface Props extends React.PropsWithChildren<{ flow: boolean }> {}
|
|
4
6
|
|
|
5
7
|
const TailwindRoot = ({ children, flow }: Props) => {
|
|
6
8
|
const Tag = flow ? 'div' : 'span';
|
|
7
9
|
|
|
8
|
-
return <Tag className=
|
|
10
|
+
return <Tag className={tailwindPrefix}>{children}</Tag>;
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
export default TailwindRoot;
|
package/dist/lib/compile.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type CompileOpts = CompileOptions & {
|
|
|
3
3
|
components?: Record<string, string>;
|
|
4
4
|
copyButtons?: boolean;
|
|
5
5
|
useTailwind?: boolean;
|
|
6
|
+
useTailwindRoot?: boolean;
|
|
6
7
|
};
|
|
7
|
-
declare const compile: (text: string, { components, copyButtons, useTailwind, ...opts }?: CompileOpts) => Promise<string>;
|
|
8
|
+
declare const compile: (text: string, { components, copyButtons, useTailwind, useTailwindRoot, ...opts }?: CompileOpts) => Promise<string>;
|
|
8
9
|
export default compile;
|
package/dist/main.js
CHANGED
|
@@ -18590,11 +18590,15 @@ function TableOfContents({ children }) {
|
|
|
18590
18590
|
}
|
|
18591
18591
|
/* harmony default export */ const components_TableOfContents = (TableOfContents);
|
|
18592
18592
|
|
|
18593
|
+
;// ./utils/consts.ts
|
|
18594
|
+
const tailwindPrefix = 'readme-tailwind';
|
|
18595
|
+
|
|
18593
18596
|
;// ./components/TailwindRoot/index.tsx
|
|
18594
18597
|
|
|
18598
|
+
|
|
18595
18599
|
const TailwindRoot = ({ children, flow }) => {
|
|
18596
18600
|
const Tag = flow ? 'div' : 'span';
|
|
18597
|
-
return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(Tag, { className:
|
|
18601
|
+
return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(Tag, { className: tailwindPrefix }, children);
|
|
18598
18602
|
};
|
|
18599
18603
|
/* harmony default export */ const components_TailwindRoot = (TailwindRoot);
|
|
18600
18604
|
|
|
@@ -71623,10 +71627,12 @@ async function tailwindBundle(string, { prefix }) {
|
|
|
71623
71627
|
|
|
71624
71628
|
|
|
71625
71629
|
|
|
71626
|
-
|
|
71630
|
+
|
|
71631
|
+
const exportTailwindStylesheet = async (tree, vfile, { components, parseRoot }) => {
|
|
71627
71632
|
if (hasNamedExport(tree, 'stylesheet'))
|
|
71628
71633
|
return;
|
|
71629
|
-
const
|
|
71634
|
+
const stringToParse = [...Object.values(components), parseRoot ? String(vfile) : ''].join('\n\n');
|
|
71635
|
+
const stylesheet = (await tailwind_bundle(stringToParse, { prefix: `.${tailwindPrefix}` })).css;
|
|
71630
71636
|
const exportNode = {
|
|
71631
71637
|
type: 'mdxjsEsm',
|
|
71632
71638
|
value: '',
|
|
@@ -71677,13 +71683,13 @@ const injectTailwindRoot = ({ components = {} }) => (node, index, parent) => {
|
|
|
71677
71683
|
// eslint-disable-next-line consistent-return
|
|
71678
71684
|
return SKIP;
|
|
71679
71685
|
};
|
|
71680
|
-
const tailwind = ({ components }) => async (tree, vfile) => {
|
|
71686
|
+
const tailwind = ({ components, parseRoot }) => async (tree, vfile) => {
|
|
71681
71687
|
const localComponents = getExports(tree).reduce((acc, name) => {
|
|
71682
71688
|
acc[name] = String(vfile);
|
|
71683
71689
|
return acc;
|
|
71684
71690
|
}, {});
|
|
71685
71691
|
visit(tree, isMDXElement, injectTailwindRoot({ components: { ...components, ...localComponents } }));
|
|
71686
|
-
await exportTailwindStylesheet(tree, { ...components, ...localComponents });
|
|
71692
|
+
await exportTailwindStylesheet(tree, vfile, { components: { ...components, ...localComponents }, parseRoot });
|
|
71687
71693
|
return tree;
|
|
71688
71694
|
};
|
|
71689
71695
|
/* harmony default export */ const transform_tailwind = (tailwind);
|
|
@@ -83709,7 +83715,7 @@ const tocToMdx = (toc, components) => {
|
|
|
83709
83715
|
|
|
83710
83716
|
|
|
83711
83717
|
const { codeTabsTransformer: compile_codeTabsTransformer, ...transforms } = defaultTransforms;
|
|
83712
|
-
const compile_compile = async (text, { components = {}, copyButtons, useTailwind, ...opts } = {}) => {
|
|
83718
|
+
const compile_compile = async (text, { components = {}, copyButtons, useTailwind, useTailwindRoot, ...opts } = {}) => {
|
|
83713
83719
|
const remarkPlugins = [
|
|
83714
83720
|
remarkFrontmatter,
|
|
83715
83721
|
remarkGfm,
|
|
@@ -83717,7 +83723,7 @@ const compile_compile = async (text, { components = {}, copyButtons, useTailwind
|
|
|
83717
83723
|
[compile_codeTabsTransformer, { copyButtons }],
|
|
83718
83724
|
];
|
|
83719
83725
|
if (useTailwind) {
|
|
83720
|
-
remarkPlugins.push([transform_tailwind, { components }]);
|
|
83726
|
+
remarkPlugins.push([transform_tailwind, { components, parseRoot: useTailwindRoot }]);
|
|
83721
83727
|
}
|
|
83722
83728
|
try {
|
|
83723
83729
|
const vfile = await compile(text, {
|
package/dist/main.node.js
CHANGED
|
@@ -21609,11 +21609,15 @@ function TableOfContents({ children }) {
|
|
|
21609
21609
|
}
|
|
21610
21610
|
/* harmony default export */ const components_TableOfContents = (TableOfContents);
|
|
21611
21611
|
|
|
21612
|
+
;// ./utils/consts.ts
|
|
21613
|
+
const tailwindPrefix = 'readme-tailwind';
|
|
21614
|
+
|
|
21612
21615
|
;// ./components/TailwindRoot/index.tsx
|
|
21613
21616
|
|
|
21617
|
+
|
|
21614
21618
|
const TailwindRoot = ({ children, flow }) => {
|
|
21615
21619
|
const Tag = flow ? 'div' : 'span';
|
|
21616
|
-
return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(Tag, { className:
|
|
21620
|
+
return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(Tag, { className: tailwindPrefix }, children);
|
|
21617
21621
|
};
|
|
21618
21622
|
/* harmony default export */ const components_TailwindRoot = (TailwindRoot);
|
|
21619
21623
|
|
|
@@ -76205,10 +76209,12 @@ async function tailwindBundle(string, { prefix }) {
|
|
|
76205
76209
|
|
|
76206
76210
|
|
|
76207
76211
|
|
|
76208
|
-
|
|
76212
|
+
|
|
76213
|
+
const exportTailwindStylesheet = async (tree, vfile, { components, parseRoot }) => {
|
|
76209
76214
|
if (hasNamedExport(tree, 'stylesheet'))
|
|
76210
76215
|
return;
|
|
76211
|
-
const
|
|
76216
|
+
const stringToParse = [...Object.values(components), parseRoot ? String(vfile) : ''].join('\n\n');
|
|
76217
|
+
const stylesheet = (await tailwind_bundle(stringToParse, { prefix: `.${tailwindPrefix}` })).css;
|
|
76212
76218
|
const exportNode = {
|
|
76213
76219
|
type: 'mdxjsEsm',
|
|
76214
76220
|
value: '',
|
|
@@ -76259,13 +76265,13 @@ const injectTailwindRoot = ({ components = {} }) => (node, index, parent) => {
|
|
|
76259
76265
|
// eslint-disable-next-line consistent-return
|
|
76260
76266
|
return SKIP;
|
|
76261
76267
|
};
|
|
76262
|
-
const tailwind = ({ components }) => async (tree, vfile) => {
|
|
76268
|
+
const tailwind = ({ components, parseRoot }) => async (tree, vfile) => {
|
|
76263
76269
|
const localComponents = getExports(tree).reduce((acc, name) => {
|
|
76264
76270
|
acc[name] = String(vfile);
|
|
76265
76271
|
return acc;
|
|
76266
76272
|
}, {});
|
|
76267
76273
|
visit(tree, isMDXElement, injectTailwindRoot({ components: { ...components, ...localComponents } }));
|
|
76268
|
-
await exportTailwindStylesheet(tree, { ...components, ...localComponents });
|
|
76274
|
+
await exportTailwindStylesheet(tree, vfile, { components: { ...components, ...localComponents }, parseRoot });
|
|
76269
76275
|
return tree;
|
|
76270
76276
|
};
|
|
76271
76277
|
/* harmony default export */ const transform_tailwind = (tailwind);
|
|
@@ -88291,7 +88297,7 @@ const tocToMdx = (toc, components) => {
|
|
|
88291
88297
|
|
|
88292
88298
|
|
|
88293
88299
|
const { codeTabsTransformer: compile_codeTabsTransformer, ...transforms } = defaultTransforms;
|
|
88294
|
-
const compile_compile = async (text, { components = {}, copyButtons, useTailwind, ...opts } = {}) => {
|
|
88300
|
+
const compile_compile = async (text, { components = {}, copyButtons, useTailwind, useTailwindRoot, ...opts } = {}) => {
|
|
88295
88301
|
const remarkPlugins = [
|
|
88296
88302
|
remarkFrontmatter,
|
|
88297
88303
|
remarkGfm,
|
|
@@ -88299,7 +88305,7 @@ const compile_compile = async (text, { components = {}, copyButtons, useTailwind
|
|
|
88299
88305
|
[compile_codeTabsTransformer, { copyButtons }],
|
|
88300
88306
|
];
|
|
88301
88307
|
if (useTailwind) {
|
|
88302
|
-
remarkPlugins.push([transform_tailwind, { components }]);
|
|
88308
|
+
remarkPlugins.push([transform_tailwind, { components, parseRoot: useTailwindRoot }]);
|
|
88303
88309
|
}
|
|
88304
88310
|
try {
|
|
88305
88311
|
const vfile = await compile(text, {
|