@readme/markdown 8.0.1 → 8.2.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.
Files changed (96) hide show
  1. package/README.md +38 -22
  2. package/components/CodeTabs/style.scss +9 -7
  3. package/components/Style/index.tsx +18 -0
  4. package/components/TailwindRoot/index.tsx +9 -0
  5. package/components/index.ts +2 -0
  6. package/dist/10.node.js +2 -1
  7. package/dist/10.node.js.map +1 -0
  8. package/dist/11.node.js +2 -1
  9. package/dist/11.node.js.map +1 -0
  10. package/dist/120.node.js +2 -1
  11. package/dist/120.node.js.map +1 -0
  12. package/dist/134.node.js +2 -1
  13. package/dist/134.node.js.map +1 -0
  14. package/dist/150.node.js +2 -1
  15. package/dist/150.node.js.map +1 -0
  16. package/dist/17.node.js +2 -1
  17. package/dist/17.node.js.map +1 -0
  18. package/dist/246.node.js +2 -1
  19. package/dist/246.node.js.map +1 -0
  20. package/dist/351.node.js +2 -1
  21. package/dist/351.node.js.map +1 -0
  22. package/dist/366.node.js +2 -1
  23. package/dist/366.node.js.map +1 -0
  24. package/dist/403.node.js +2 -1
  25. package/dist/403.node.js.map +1 -0
  26. package/dist/429.node.js +2 -1
  27. package/dist/429.node.js.map +1 -0
  28. package/dist/485.node.js +2 -1
  29. package/dist/485.node.js.map +1 -0
  30. package/dist/486.node.js +2 -1
  31. package/dist/486.node.js.map +1 -0
  32. package/dist/488.node.js +2 -1
  33. package/dist/488.node.js.map +1 -0
  34. package/dist/489.node.js +2 -1
  35. package/dist/489.node.js.map +1 -0
  36. package/dist/510.node.js +2 -1
  37. package/dist/510.node.js.map +1 -0
  38. package/dist/52.node.js +2 -1
  39. package/dist/52.node.js.map +1 -0
  40. package/dist/550.node.js +2 -1
  41. package/dist/550.node.js.map +1 -0
  42. package/dist/551.node.js +2 -1
  43. package/dist/551.node.js.map +1 -0
  44. package/dist/617.node.js +2 -1
  45. package/dist/617.node.js.map +1 -0
  46. package/dist/687.node.js +2 -1
  47. package/dist/687.node.js.map +1 -0
  48. package/dist/745.node.js +2 -1
  49. package/dist/745.node.js.map +1 -0
  50. package/dist/775.node.js +2 -1
  51. package/dist/775.node.js.map +1 -0
  52. package/dist/786.node.js +2 -1
  53. package/dist/786.node.js.map +1 -0
  54. package/dist/788.node.js +2 -1
  55. package/dist/788.node.js.map +1 -0
  56. package/dist/81.node.js +2 -1
  57. package/dist/81.node.js.map +1 -0
  58. package/dist/849.node.js +2 -1
  59. package/dist/849.node.js.map +1 -0
  60. package/dist/863.node.js +2 -1
  61. package/dist/863.node.js.map +1 -0
  62. package/dist/867.node.js +2 -1
  63. package/dist/867.node.js.map +1 -0
  64. package/dist/881.node.js +2 -1
  65. package/dist/881.node.js.map +1 -0
  66. package/dist/885.node.js +2 -1
  67. package/dist/885.node.js.map +1 -0
  68. package/dist/896.node.js +2 -1
  69. package/dist/896.node.js.map +1 -0
  70. package/dist/906.node.js +2 -1
  71. package/dist/906.node.js.map +1 -0
  72. package/dist/91.node.js +2 -1
  73. package/dist/91.node.js.map +1 -0
  74. package/dist/940.node.js +2 -1
  75. package/dist/940.node.js.map +1 -0
  76. package/dist/952.node.js +2 -1
  77. package/dist/952.node.js.map +1 -0
  78. package/dist/995.node.js +2 -1
  79. package/dist/995.node.js.map +1 -0
  80. package/dist/components/Style/index.d.ts +6 -0
  81. package/dist/components/TailwindRoot/index.d.ts +6 -0
  82. package/dist/components/index.d.ts +2 -0
  83. package/dist/example/components.d.ts +7 -0
  84. package/dist/lib/compile.d.ts +2 -1
  85. package/dist/lib/run.d.ts +1 -0
  86. package/dist/lib/styles.d.ts +2 -0
  87. package/dist/main.css +3 -1
  88. package/dist/main.css.map +1 -0
  89. package/dist/main.js +37280 -32323
  90. package/dist/main.node.js +20261 -11800
  91. package/dist/main.node.js.map +1 -0
  92. package/dist/processor/transform/index.d.ts +2 -1
  93. package/dist/processor/transform/tailwind.d.ts +6 -0
  94. package/dist/processor/utils.d.ts +16 -1
  95. package/dist/utils/tailwind-bundle.d.ts +5 -0
  96. package/package.json +8 -5
@@ -7,7 +7,8 @@ import readmeComponentsTransformer from './readme-components';
7
7
  import readmeToMdx from './readme-to-mdx';
8
8
  import tablesToJsx from './tables-to-jsx';
9
9
  import variablesTransformer from './variables';
10
- export { compatabilityTransfomer, divTransformer, injectComponents, mdxToHast, mermaidTransformer, readmeComponentsTransformer, readmeToMdx, tablesToJsx, variablesTransformer, };
10
+ import tailwindTransformer from './tailwind';
11
+ export { compatabilityTransfomer, divTransformer, injectComponents, mdxToHast, mermaidTransformer, readmeComponentsTransformer, readmeToMdx, tablesToJsx, tailwindTransformer, variablesTransformer, };
11
12
  export declare const defaultTransforms: {
12
13
  calloutTransformer: () => (tree: any) => void;
13
14
  codeTabsTransformer: ({ copyButtons }?: {
@@ -0,0 +1,6 @@
1
+ import { Plugin } from 'unified';
2
+ interface TailwindRootOptions {
3
+ components: Record<string, string>;
4
+ }
5
+ declare const tailwind: Plugin<[TailwindRootOptions]>;
6
+ export default tailwind;
@@ -1,4 +1,5 @@
1
- import type { Node } from 'mdast';
1
+ import type { Node, Root as MdastRoot, Root } from 'mdast';
2
+ import type { Root as HastRoot } from 'hast';
2
3
  import type { MdxJsxFlowElement, MdxJsxTextElement, MdxjsEsm } from 'mdast-util-mdx';
3
4
  import type { MdxJsxAttribute } from 'mdast-util-mdx-jsx';
4
5
  /**
@@ -84,3 +85,17 @@ export declare const formatHTML: (html: string) => string;
84
85
  */
85
86
  export declare const reformatHTML: (html: string, indent?: number) => string;
86
87
  export declare const toAttributes: (object: Record<string, any>, keys?: string[]) => MdxJsxAttribute[];
88
+ /**
89
+ * Checks if a named export exists in the MDX tree. Accepts either an mdast or
90
+ * a hast tree.
91
+ *
92
+ * example:
93
+ * ```
94
+ * const mdx = `export const Foo = 'bar';`
95
+ *
96
+ * hasNamedExport(mdast(mdx), 'Foo') => true
97
+ * ```
98
+ *
99
+ */
100
+ export declare const hasNamedExport: (tree: MdastRoot | HastRoot, name: string) => boolean;
101
+ export declare const getExports: (tree: Root) => string[];
@@ -0,0 +1,5 @@
1
+ import postcss from 'postcss';
2
+ declare function tailwindBundle(string: string, { prefix }: {
3
+ prefix: string;
4
+ }): Promise<postcss.Result<postcss.Root>>;
5
+ export default tailwindBundle;
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": "8.0.1",
5
+ "version": "8.2.0",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",
@@ -42,6 +42,8 @@
42
42
  "mdast-util-find-and-replace": "^3.0.1",
43
43
  "mdast-util-phrasing": "^4.1.0",
44
44
  "path-browserify": "^1.0.1",
45
+ "postcss": "^8.5.1",
46
+ "postcss-prefix-selector": "^2.1.0",
45
47
  "process": "^0.11.10",
46
48
  "prop-types": "^15.8.1",
47
49
  "rehype-remark": "^10.0.0",
@@ -51,6 +53,7 @@
51
53
  "remark-gfm": "^4.0.0",
52
54
  "remark-mdx": "^3.0.0",
53
55
  "remark-parse": "^11.0.0",
56
+ "tailwindcss": "^4.0.3",
54
57
  "unified": "^11.0.4",
55
58
  "unist-util-flatmap": "^1.0.0",
56
59
  "unist-util-visit": "^5.0.0",
@@ -92,8 +95,8 @@
92
95
  "@types/mdx": "^2.0.12",
93
96
  "@types/unist": "^3.0.2",
94
97
  "@vitejs/plugin-react": "^4.2.1",
95
- "@vitest/coverage-v8": "^1.6.0",
96
- "@vitest/ui": "^1.6.0",
98
+ "@vitest/coverage-v8": "^3.0.5",
99
+ "@vitest/ui": "^3.0.5",
97
100
  "babel-jest": "^29.5.0",
98
101
  "babel-loader": "^9.1.2",
99
102
  "browserify-fs": "^1.0.0",
@@ -120,9 +123,9 @@
120
123
  "string.prototype.trimend": "^1.0.6",
121
124
  "terser-webpack-plugin": "^5.3.7",
122
125
  "ts-loader": "^9.4.2",
123
- "typescript": "^5.4.5",
126
+ "typescript": "^5.7.3",
124
127
  "unist-util-map": "^4.0.0",
125
- "vitest": "^1.4.0",
128
+ "vitest": "^3.0.5",
126
129
  "webpack": "^5.56.0",
127
130
  "webpack-cli": "^5.0.1",
128
131
  "webpack-dev-server": "^4.13.2",