@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.
- package/README.md +38 -22
- package/components/CodeTabs/style.scss +9 -7
- package/components/Style/index.tsx +18 -0
- package/components/TailwindRoot/index.tsx +9 -0
- package/components/index.ts +2 -0
- package/dist/10.node.js +2 -1
- package/dist/10.node.js.map +1 -0
- package/dist/11.node.js +2 -1
- package/dist/11.node.js.map +1 -0
- package/dist/120.node.js +2 -1
- package/dist/120.node.js.map +1 -0
- package/dist/134.node.js +2 -1
- package/dist/134.node.js.map +1 -0
- package/dist/150.node.js +2 -1
- package/dist/150.node.js.map +1 -0
- package/dist/17.node.js +2 -1
- package/dist/17.node.js.map +1 -0
- package/dist/246.node.js +2 -1
- package/dist/246.node.js.map +1 -0
- package/dist/351.node.js +2 -1
- package/dist/351.node.js.map +1 -0
- package/dist/366.node.js +2 -1
- package/dist/366.node.js.map +1 -0
- package/dist/403.node.js +2 -1
- package/dist/403.node.js.map +1 -0
- package/dist/429.node.js +2 -1
- package/dist/429.node.js.map +1 -0
- package/dist/485.node.js +2 -1
- package/dist/485.node.js.map +1 -0
- package/dist/486.node.js +2 -1
- package/dist/486.node.js.map +1 -0
- package/dist/488.node.js +2 -1
- package/dist/488.node.js.map +1 -0
- package/dist/489.node.js +2 -1
- package/dist/489.node.js.map +1 -0
- package/dist/510.node.js +2 -1
- package/dist/510.node.js.map +1 -0
- package/dist/52.node.js +2 -1
- package/dist/52.node.js.map +1 -0
- package/dist/550.node.js +2 -1
- package/dist/550.node.js.map +1 -0
- package/dist/551.node.js +2 -1
- package/dist/551.node.js.map +1 -0
- package/dist/617.node.js +2 -1
- package/dist/617.node.js.map +1 -0
- package/dist/687.node.js +2 -1
- package/dist/687.node.js.map +1 -0
- package/dist/745.node.js +2 -1
- package/dist/745.node.js.map +1 -0
- package/dist/775.node.js +2 -1
- package/dist/775.node.js.map +1 -0
- package/dist/786.node.js +2 -1
- package/dist/786.node.js.map +1 -0
- package/dist/788.node.js +2 -1
- package/dist/788.node.js.map +1 -0
- package/dist/81.node.js +2 -1
- package/dist/81.node.js.map +1 -0
- package/dist/849.node.js +2 -1
- package/dist/849.node.js.map +1 -0
- package/dist/863.node.js +2 -1
- package/dist/863.node.js.map +1 -0
- package/dist/867.node.js +2 -1
- package/dist/867.node.js.map +1 -0
- package/dist/881.node.js +2 -1
- package/dist/881.node.js.map +1 -0
- package/dist/885.node.js +2 -1
- package/dist/885.node.js.map +1 -0
- package/dist/896.node.js +2 -1
- package/dist/896.node.js.map +1 -0
- package/dist/906.node.js +2 -1
- package/dist/906.node.js.map +1 -0
- package/dist/91.node.js +2 -1
- package/dist/91.node.js.map +1 -0
- package/dist/940.node.js +2 -1
- package/dist/940.node.js.map +1 -0
- package/dist/952.node.js +2 -1
- package/dist/952.node.js.map +1 -0
- package/dist/995.node.js +2 -1
- package/dist/995.node.js.map +1 -0
- package/dist/components/Style/index.d.ts +6 -0
- package/dist/components/TailwindRoot/index.d.ts +6 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/example/components.d.ts +7 -0
- package/dist/lib/compile.d.ts +2 -1
- package/dist/lib/run.d.ts +1 -0
- package/dist/lib/styles.d.ts +2 -0
- package/dist/main.css +3 -1
- package/dist/main.css.map +1 -0
- package/dist/main.js +37280 -32323
- package/dist/main.node.js +20261 -11800
- package/dist/main.node.js.map +1 -0
- package/dist/processor/transform/index.d.ts +2 -1
- package/dist/processor/transform/tailwind.d.ts +6 -0
- package/dist/processor/utils.d.ts +16 -1
- package/dist/utils/tailwind-bundle.d.ts +5 -0
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -1,9 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<img
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
|
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
|
|
71
|
-
- **`tags`**: get a list of tag names from the doc. (This
|
|
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
|
|
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: #
|
|
6
|
-
$bgc-pre-dark: #
|
|
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) {
|
|
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;
|
package/components/index.ts
CHANGED
|
@@ -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
|