@astrojs/mdx 0.8.1 → 0.8.2
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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +6 -0
- package/README.md +4 -4
- package/dist/index.js +2 -2
- package/package.json +2 -2
- package/src/index.ts +2 -2
- package/test/fixtures/mdx-component/dist/index.html +3 -0
- package/test/fixtures/mdx-component/node_modules/.vite/deps_temp/package.json +1 -0
- package/test/fixtures/mdx-custom-frontmatter-name/dist/glob.json +1 -0
- package/test/fixtures/mdx-custom-frontmatter-name/dist/index.html +1 -0
- package/test/fixtures/mdx-custom-frontmatter-name/node_modules/.vite/deps_temp/package.json +1 -0
- package/test/fixtures/mdx-frontmatter/dist/glob.json +1 -0
- package/test/fixtures/mdx-frontmatter/dist/index.html +17 -0
- package/test/fixtures/mdx-frontmatter/dist/with-headings/index.html +18 -0
- package/test/fixtures/mdx-frontmatter/node_modules/.vite/deps_temp/package.json +1 -0
- package/test/fixtures/mdx-frontmatter-injection/node_modules/.bin/astro +2 -2
- package/test/fixtures/mdx-get-headings/dist/pages.json +1 -0
- package/test/fixtures/mdx-get-headings/dist/test/index.html +5 -0
- package/test/fixtures/mdx-get-headings/dist/test-with-jsx-expressions/index.html +3 -0
- package/test/fixtures/mdx-get-headings/node_modules/.vite/deps_temp/package.json +1 -0
- package/test/fixtures/mdx-get-static-paths/dist/one/index.html +13 -0
- package/test/fixtures/mdx-page/dist/index.html +1 -0
- package/test/fixtures/mdx-page/node_modules/.bin/astro +2 -2
- package/test/fixtures/mdx-page/node_modules/.vite/deps_temp/package.json +1 -0
- package/test/fixtures/mdx-plus-react/dist/client.0d691cb3.js +32 -0
- package/test/fixtures/mdx-plus-react/dist/index.html +8 -0
- package/test/fixtures/mdx-plus-react/node_modules/.bin/astro +2 -2
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/@astrojs_react_client__js.js +95 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/@astrojs_react_client__js.js.map +7 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/_metadata.json +47 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/chunk-CDYRCHBX.js +7480 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/chunk-CDYRCHBX.js.map +7 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/chunk-RRXZ3AUC.js +326 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/chunk-RRXZ3AUC.js.map +7 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/chunk-TWLJ45QX.js +27 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/chunk-TWLJ45QX.js.map +7 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/package.json +1 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react-dom.js +12 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react-dom.js.map +7 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react.js +11 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react.js.map +7 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react_jsx-dev-runtime.js +41 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react_jsx-dev-runtime.js.map +7 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react_jsx-runtime.js +62 -0
- package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react_jsx-runtime.js.map +7 -0
- package/test/fixtures/mdx-rehype-plugins/dist/reading-time.json +1 -0
- package/test/fixtures/mdx-rehype-plugins/dist/space-ipsum/index.html +13 -0
- package/test/fixtures/mdx-rehype-plugins/node_modules/.vite/deps_temp/package.json +1 -0
- package/test/fixtures/mdx-remark-plugins/dist/with-gfm/index.html +2 -0
- package/test/fixtures/mdx-remark-plugins/dist/with-toc/index.html +22 -0
- package/test/fixtures/mdx-remark-plugins/node_modules/.vite/deps_temp/package.json +1 -0
- package/test/fixtures/mdx-syntax-hightlighting/dist/index.html +6 -0
- package/test/fixtures/mdx-syntax-hightlighting/node_modules/.vite/deps_temp/package.json +1 -0
- package/test/fixtures/mdx-url-export/dist/pages.json +1 -0
- package/test/fixtures/mdx-url-export/dist/test-1/index.html +1 -0
- package/test/fixtures/mdx-url-export/dist/test-2/index.html +1 -0
- package/test/fixtures/mdx-url-export/dist/with-url-override/index.html +1 -0
- package/test/fixtures/mdx-url-export/node_modules/.vite/deps_temp/package.json +1 -0
- package/test/fixtures/node_modules/.vite/deps_temp/package.json +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
1
|
+
[32m@astrojs/mdx:build: [0mcache hit, replaying output [2m3036c715efc9fce9[0m
|
|
2
|
+
[32m@astrojs/mdx:build: [0m
|
|
3
|
+
[32m@astrojs/mdx:build: [0m> @astrojs/mdx@0.8.2 build /Users/matthew/dev/astro/packages/integrations/mdx
|
|
4
|
+
[32m@astrojs/mdx:build: [0m> astro-scripts build "src/**/*.ts" && tsc
|
|
5
|
+
[32m@astrojs/mdx:build: [0m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @astrojs/mdx
|
|
2
2
|
|
|
3
|
+
## 0.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#4237](https://github.com/withastro/astro/pull/4237) [`9d5ab5508`](https://github.com/withastro/astro/commit/9d5ab55086964fbede17da3d78c209c6d8d13711) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Update "Astro.props.content" -> "Astro.props.frontmatter" in README
|
|
8
|
+
|
|
3
9
|
## 0.8.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -195,19 +195,19 @@ title: 'My Blog Post'
|
|
|
195
195
|
---
|
|
196
196
|
```
|
|
197
197
|
|
|
198
|
-
Then, you can retrieve all other frontmatter properties from your layout via the `
|
|
198
|
+
Then, you can retrieve all other frontmatter properties from your layout via the `frontmatter` property, and render your MDX using the default [`<slot />`](https://docs.astro.build/en/core-concepts/astro-components/#slots):
|
|
199
199
|
|
|
200
200
|
```astro
|
|
201
201
|
---
|
|
202
202
|
// src/layouts/BaseLayout.astro
|
|
203
|
-
const {
|
|
203
|
+
const { frontmatter } = Astro.props;
|
|
204
204
|
---
|
|
205
205
|
<html>
|
|
206
206
|
<head>
|
|
207
|
-
<title>{
|
|
207
|
+
<title>{frontmatter.title}</title>
|
|
208
208
|
</head>
|
|
209
209
|
<body>
|
|
210
|
-
<h1>{
|
|
210
|
+
<h1>{frontmatter.title}</h1>
|
|
211
211
|
<!-- Rendered MDX will be passed into the default slot. -->
|
|
212
212
|
<slot />
|
|
213
213
|
</body>
|
package/dist/index.js
CHANGED
|
@@ -37,9 +37,9 @@ function getRemarkPlugins(mdxOptions, config) {
|
|
|
37
37
|
function getRehypePlugins(mdxOptions, config) {
|
|
38
38
|
let rehypePlugins = handleExtends(mdxOptions.rehypePlugins, DEFAULT_REHYPE_PLUGINS);
|
|
39
39
|
if (config.markdown.syntaxHighlight === "shiki" || config.markdown.syntaxHighlight === "prism") {
|
|
40
|
-
rehypePlugins.
|
|
40
|
+
rehypePlugins.unshift([rehypeRaw, { passThrough: nodeTypes }]);
|
|
41
41
|
}
|
|
42
|
-
rehypePlugins.
|
|
42
|
+
rehypePlugins.unshift(rehypeCollectHeadings);
|
|
43
43
|
return rehypePlugins;
|
|
44
44
|
}
|
|
45
45
|
function mdx(mdxOptions = {}) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/mdx",
|
|
3
3
|
"description": "Use MDX within Astro",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@types/chai": "^4.3.1",
|
|
44
44
|
"@types/mocha": "^9.1.1",
|
|
45
45
|
"@types/yargs-parser": "^21.0.0",
|
|
46
|
-
"astro": "1.0.
|
|
46
|
+
"astro": "1.0.2",
|
|
47
47
|
"astro-scripts": "0.0.7",
|
|
48
48
|
"chai": "^4.3.6",
|
|
49
49
|
"linkedom": "^0.14.12",
|
package/src/index.ts
CHANGED
|
@@ -62,10 +62,10 @@ function getRehypePlugins(
|
|
|
62
62
|
let rehypePlugins = handleExtends(mdxOptions.rehypePlugins, DEFAULT_REHYPE_PLUGINS);
|
|
63
63
|
|
|
64
64
|
if (config.markdown.syntaxHighlight === 'shiki' || config.markdown.syntaxHighlight === 'prism') {
|
|
65
|
-
rehypePlugins.
|
|
65
|
+
rehypePlugins.unshift([rehypeRaw, { passThrough: nodeTypes }]);
|
|
66
66
|
}
|
|
67
67
|
// getHeadings() is guaranteed by TS, so we can't allow user to override
|
|
68
|
-
rehypePlugins.
|
|
68
|
+
rehypePlugins.unshift(rehypeCollectHeadings);
|
|
69
69
|
|
|
70
70
|
return rehypePlugins;
|
|
71
71
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"titles":["Using YAML frontmatter"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!DOCTYPE html><h1 id="customfrontmatterillthrowifidontexist">Oh no, that's scary!</h1>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"titles":["Using YAML frontmatter",null]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!DOCTYPE html><html lang="en">
|
|
2
|
+
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
</head>
|
|
8
|
+
|
|
9
|
+
<body>
|
|
10
|
+
<p data-content-title>Using YAML frontmatter</p>
|
|
11
|
+
<p data-frontmatter-title>Using YAML frontmatter</p>
|
|
12
|
+
<p data-layout-rendered>Layout rendered!</p>
|
|
13
|
+
<ul data-headings>
|
|
14
|
+
|
|
15
|
+
</ul>
|
|
16
|
+
Oh no, that's scary!
|
|
17
|
+
</body></html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!DOCTYPE html><html lang="en">
|
|
2
|
+
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
</head>
|
|
8
|
+
|
|
9
|
+
<body>
|
|
10
|
+
<p data-content-title></p>
|
|
11
|
+
<p data-frontmatter-title></p>
|
|
12
|
+
<p data-layout-rendered>Layout rendered!</p>
|
|
13
|
+
<ul data-headings>
|
|
14
|
+
<li>section-1</li><li>section-2</li>
|
|
15
|
+
</ul>
|
|
16
|
+
<h2 id="section-1">Section 1</h2>
|
|
17
|
+
<h2 id="section-2">Section 2</h2>
|
|
18
|
+
</body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -6,9 +6,9 @@ case `uname` in
|
|
|
6
6
|
esac
|
|
7
7
|
|
|
8
8
|
if [ -z "$NODE_PATH" ]; then
|
|
9
|
-
export NODE_PATH="/
|
|
9
|
+
export NODE_PATH="/Users/matthew/dev/astro/node_modules/.pnpm/node_modules"
|
|
10
10
|
else
|
|
11
|
-
export NODE_PATH="$NODE_PATH:/
|
|
11
|
+
export NODE_PATH="$NODE_PATH:/Users/matthew/dev/astro/node_modules/.pnpm/node_modules"
|
|
12
12
|
fi
|
|
13
13
|
if [ -x "$basedir/node" ]; then
|
|
14
14
|
exec "$basedir/node" "$basedir/../../../../../../../astro/astro.js" "$@"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"headingsByPage":{"./test-with-jsx-expressions.mdx":[{"depth":1,"slug":"heading-test-with-jsx-expressions","text":"Heading test with JSX expressions"},{"depth":2,"slug":"h2title","text":"h2Title"},{"depth":3,"slug":"h3title","text":"h3Title"}],"./test.mdx":[{"depth":1,"slug":"heading-test","text":"Heading test"},{"depth":2,"slug":"section-1","text":"Section 1"},{"depth":3,"slug":"subsection-1","text":"Subsection 1"},{"depth":3,"slug":"subsection-2","text":"Subsection 2"},{"depth":2,"slug":"section-2","text":"Section 2"}]}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Page</title>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<p>First mdx file</p>
|
|
8
|
+
|
|
9
|
+
<div id="one">hello</div>
|
|
10
|
+
<div id="url">/src/content/1.mdx</div>
|
|
11
|
+
<div id="file">/Users/matthew/dev/astro/packages/integrations/mdx/test/fixtures/mdx-get-static-paths/src/content/1.mdx</div>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!DOCTYPE html><h1 id="hello-page">Hello page!</h1>
|
|
@@ -6,9 +6,9 @@ case `uname` in
|
|
|
6
6
|
esac
|
|
7
7
|
|
|
8
8
|
if [ -z "$NODE_PATH" ]; then
|
|
9
|
-
export NODE_PATH="/
|
|
9
|
+
export NODE_PATH="/Users/matthew/dev/astro/node_modules/.pnpm/node_modules"
|
|
10
10
|
else
|
|
11
|
-
export NODE_PATH="$NODE_PATH:/
|
|
11
|
+
export NODE_PATH="$NODE_PATH:/Users/matthew/dev/astro/node_modules/.pnpm/node_modules"
|
|
12
12
|
fi
|
|
13
13
|
if [ -x "$basedir/node" ]; then
|
|
14
14
|
exec "$basedir/node" "$basedir/../../../../../../../astro/astro.js" "$@"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|