@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
package/README.md CHANGED
@@ -1,9 +1,27 @@
1
- # <img align="right" width="26%" src="https://owlbertsio-resized.s3.amazonaws.com/Reading.psd.full.png"> `@readme/markdown`
2
-
3
- <img align=right src=https://github.com/readmeio/markdown/workflows/CI/badge.svg alt="RDMD CI Status"> ReadMe's MDX rendering engine and custom component collection.
4
- <br/>  *(Use ReadMe? [Learn more about our upcoming move to MDX](https://docs.readme.com/rdmd/page/mdx-engine)!)*
5
-
6
- ## Getting Started
1
+ <p align="center">
2
+ <a href="https://npm.im/@readme/markdown">
3
+ <img src="https://owlbertsio-resized.s3.amazonaws.com/Reading.psd.full.png" width="150" alt="rmdx" />
4
+ </a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ ReadMe's MDX rendering engine and custom component collection.<br />
9
+ <sub>
10
+ Use ReadMe? <a href="https://docs.readme.com/rdmd/page/mdx-engine">Learn more about our upcoming move to MDX!</a>
11
+ </sub>
12
+ </p>
13
+
14
+ <p align="center">
15
+ <a href="https://npm.im/@readme/markdown"><img src="https://img.shields.io/npm/v/@readme/markdown?style=for-the-badge" alt="NPM Version" /></a>
16
+ <a href="https://npm.im/@readme/markdown"><img src="https://img.shields.io/npm/l/@readme/markdown?style=for-the-badge" alt="MIT License" /></a>
17
+ <a href="https://github.com/readmeio/markdown"><img src="https://img.shields.io/github/actions/workflow/status/readmeio/markdown/ci.yml?branch=main&style=for-the-badge" alt="Build status" /></a>
18
+ </p>
19
+
20
+ <p align="center">
21
+ <a href="https://readme.com"><img src="https://raw.githubusercontent.com/readmeio/.github/main/oss-badge.svg" /></a>
22
+ </p>
23
+
24
+ ## Usage
7
25
 
8
26
  To use the engine, install it from NPM:
9
27
 
@@ -16,11 +34,7 @@ Then [`compile`](#compile) and [`run`](#run) your MDX:
16
34
  ```jsx
17
35
  import RMDX from '@readme/markdown';
18
36
 
19
- export default ({ body }) => (
20
- <div className="markdown-body">
21
- {RMDX.run(RMDX.compile(body))}
22
- </div>
23
- );
37
+ export default ({ body }) => <div className="markdown-body">{RMDX.run(RMDX.compile(body))}</div>;
24
38
  ```
25
39
 
26
40
  ## API
@@ -42,13 +56,15 @@ A string of compiled Javascript module code.
42
56
 
43
57
  > [!CAUTION]
44
58
  > This is essentially a wrapper around [`mdx.run`](https://mdxjs.com/packages/mdx/#runcode-options) and **it will `eval` the compiled MDX**. Make sure you only call `run` on safe syntax from a trusted author!
45
- >
46
- > #### Parameters
47
- > - **`string`** (`string`)—a compiled mdx document
48
- > - **`opts`** (`RunOpts`, optional)—configuration
49
- >
50
- > #### Returns
51
- > An [`RMDXModule`](#rmdxmodule) of renderable components.
59
+
60
+ #### Parameters
61
+
62
+ - **`string`** (`string`)—a compiled mdx document
63
+ - **`opts`** (`RunOpts`, optional)—configuration
64
+
65
+ #### Returns
66
+
67
+ An [`RMDXModule`](#rmdxmodule) of renderable components.
52
68
 
53
69
  ### `mdx`
54
70
 
@@ -57,7 +73,7 @@ Compiles an AST to a string of MDX syntax.
57
73
  #### Parameters
58
74
 
59
75
  - **`tree`** (`object`)—an abstract syntax tree
60
- - **`opts`** ([`Options`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#options "`remark-stringify` Options type"))—`remark-stringify` configuration.
76
+ - **`opts`** ([`Options`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#options '`remark-stringify` Options type'))—`remark-stringify` configuration.
61
77
 
62
78
  #### Returns
63
79
 
@@ -67,8 +83,8 @@ An MDX string.
67
83
 
68
84
  - **`mdast`**: parse MDX syntax to MDAST.
69
85
  - **`hast`**: parse MDX syntax to HAST.
70
- - **`plain`**: parse MDX to a plaintext string with all Markdown syntax removed. (This *does not* `eval` the doc.)
71
- - **`tags`**: get a list of tag names from the doc. (This *does not* `eval` the doc.)
86
+ - **`plain`**: parse MDX to a plaintext string with all Markdown syntax removed. (This _does not_ `eval` the doc.)
87
+ - **`tags`**: get a list of tag names from the doc. (This _does not_ `eval` the doc.)
72
88
  - **`utils`**: additional defaults, helper methods, components, and so on.
73
89
 
74
90
  ## Types
@@ -103,7 +119,7 @@ Extends [`RunOptions`](https://mdxjs.com/packages/mdx/#runoptions)
103
119
  - **`toc`** (`HastHeading[]`)—a list of headings in the document
104
120
  - **`Toc`** (`() => MDCContent`)—a table of contents component
105
121
 
106
- ## Local Development and Testing
122
+ ## Local development and testing
107
123
 
108
124
  To make changes to the RDMD engine locally, run the local development server. Clone the repo, `cd` in to it, `npm install`, and `npm run start`!
109
125
 
@@ -2,8 +2,8 @@
2
2
  @import '~codemirror/theme/neo.css';
3
3
 
4
4
  @mixin CodeTabs {
5
- $bgc-pre: #F6F8FA;
6
- $bgc-pre-dark: #242E34;
5
+ $bgc-pre: #f6f8fa;
6
+ $bgc-pre-dark: #242e34;
7
7
  $bgc-bar: darken(desaturate($bgc-pre, 17.46), 4.31);
8
8
  $bgc-bar-dark: lighten(desaturate($bgc-pre-dark, 17.46), 4.31);
9
9
  $radius: var(--md-code-radius, var(--markdown-radius, 3px));
@@ -36,18 +36,18 @@
36
36
  }
37
37
  button {
38
38
  white-space: nowrap;
39
- transition: .123s ease;
39
+ transition: 0.123s ease;
40
40
  -webkit-appearance: none;
41
41
  appearance: none;
42
42
  display: inline-block;
43
43
  line-height: 2;
44
- padding: .5em 1em;
44
+ padding: 0.5em 1em;
45
45
  border: none;
46
46
  background: transparent;
47
47
  outline: none;
48
48
  color: inherit;
49
49
  font: inherit;
50
- font-size: .75em;
50
+ font-size: 0.75em;
51
51
  cursor: pointer;
52
52
  }
53
53
  }
@@ -70,7 +70,7 @@
70
70
  }
71
71
 
72
72
  &-toolbar button:not(.CodeTabs_active):hover {
73
- background: rgba(0, 0, 0, .075);
73
+ background: rgba(0, 0, 0, 0.075);
74
74
  }
75
75
 
76
76
  pre {
@@ -78,7 +78,9 @@
78
78
  background: $bgc-pre;
79
79
  background: var(--md-code-background, $bgc-pre);
80
80
  margin-bottom: 0;
81
- &:not(.CodeTabs_active) { display: none }
81
+ &:not(.CodeTabs_active) {
82
+ display: none;
83
+ }
82
84
  }
83
85
 
84
86
  &.theme-dark pre {
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { createPortal } from 'react-dom';
3
+
4
+ interface Props {
5
+ stylesheet?: string;
6
+ }
7
+
8
+ const Style = ({ stylesheet }: Props) => {
9
+ const hasDom = typeof document !== 'undefined';
10
+
11
+ if (!stylesheet) {
12
+ return null;
13
+ }
14
+
15
+ return hasDom ? createPortal(<style>{stylesheet}</style>, document.head) : <style>{stylesheet}</style>;
16
+ };
17
+
18
+ export default Style;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+
3
+ const TailwindRoot = ({ children, flow }) => {
4
+ const Tag = flow ? 'div' : 'span';
5
+
6
+ return <Tag className="readme-tailwind">{children}</Tag>;
7
+ };
8
+
9
+ export default TailwindRoot;
@@ -10,6 +10,8 @@ export { default as Glossary } from './Glossary';
10
10
  export { default as HTMLBlock } from './HTMLBlock';
11
11
  export { default as Heading } from './Heading';
12
12
  export { default as Image } from './Image';
13
+ export { default as Style } from './Style';
13
14
  export { default as Table } from './Table';
14
15
  export { default as Tabs, Tab } from './Tabs';
15
16
  export { default as TableOfContents } from './TableOfContents';
17
+ export { default as TailwindRoot } from './TailwindRoot';
package/dist/10.node.js CHANGED
@@ -22718,4 +22718,5 @@ exports["default"] = RAL;
22718
22718
  /***/ })
22719
22719
 
22720
22720
  };
22721
- ;
22721
+ ;
22722
+ //# sourceMappingURL=10.node.js.map