@astrojs/mdx 1.1.4 → 2.0.0-beta.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 +1 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -1
- package/dist/plugins.d.ts +1 -2
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +28 -28
package/README.md
CHANGED
|
@@ -83,11 +83,7 @@ You can configure how your MDX is rendered with the following options:
|
|
|
83
83
|
|
|
84
84
|
### Options inherited from Markdown config
|
|
85
85
|
|
|
86
|
-
All [`markdown` configuration options](https://docs.astro.build/en/reference/configuration-reference/#markdown-options)
|
|
87
|
-
|
|
88
|
-
:::note
|
|
89
|
-
There is no separate MDX configuration for [including pages marked as draft in the build](https://docs.astro.build/en/reference/configuration-reference/#markdowndrafts). This Markdown setting will be respected by both Markdown and MDX files and cannot be overridden for MDX files specifically.
|
|
90
|
-
:::
|
|
86
|
+
All [`markdown` configuration options](https://docs.astro.build/en/reference/configuration-reference/#markdown-options) can be configured separately in the MDX integration. This includes remark and rehype plugins, syntax highlighting, and more. Options will default to those in your Markdown config ([see the `extendMarkdownConfig` option](#extendmarkdownconfig) to modify this).
|
|
91
87
|
|
|
92
88
|
```js
|
|
93
89
|
// astro.config.mjs
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { markdownConfigDefaults } from '@astrojs/markdown-remark';
|
|
2
|
-
import type { PluggableList } from '@mdx-js/mdx/lib/core.js';
|
|
3
2
|
import type { AstroIntegration } from 'astro';
|
|
3
|
+
import type { PluggableList } from 'unified';
|
|
4
4
|
import type { Options as RemarkRehypeOptions } from 'remark-rehype';
|
|
5
5
|
import type { OptimizeOptions } from './rehype-optimize-static.js';
|
|
6
6
|
export type MdxOptions = Omit<typeof markdownConfigDefaults, 'remarkPlugins' | 'rehypePlugins'> & {
|
package/dist/index.js
CHANGED
|
@@ -134,7 +134,10 @@ export const file = ${JSON.stringify(fileId)};`;
|
|
|
134
134
|
componentsCode += ` ${JSON.stringify(ASTRO_IMAGE_ELEMENT)}: ${hasComponents ? "components.img ?? " : ""} props.components?.img ?? ${ASTRO_IMAGE_IMPORT}`;
|
|
135
135
|
}
|
|
136
136
|
componentsCode += " }";
|
|
137
|
-
code = code.replace(
|
|
137
|
+
code = code.replace(
|
|
138
|
+
"export default function MDXContent",
|
|
139
|
+
"function MDXContent"
|
|
140
|
+
);
|
|
138
141
|
code += `
|
|
139
142
|
export const Content = (props = {}) => MDXContent({
|
|
140
143
|
...props,
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { Processor } from 'unified';
|
|
2
1
|
import type { MdxOptions } from './index.js';
|
|
3
2
|
interface MdxProcessorExtraOptions {
|
|
4
3
|
sourcemap: boolean;
|
|
5
4
|
importMetaEnv: Record<string, any>;
|
|
6
5
|
}
|
|
7
|
-
export declare function createMdxProcessor(mdxOptions: MdxOptions, extraOptions: MdxProcessorExtraOptions): Processor
|
|
6
|
+
export declare function createMdxProcessor(mdxOptions: MdxOptions, extraOptions: MdxProcessorExtraOptions): import("unified").Processor<import("mdast").Root, import("estree").Program, import("estree").Program, import("estree").Program, string>;
|
|
8
7
|
export {};
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { PluggableList } from '@mdx-js/mdx/lib/core.js';
|
|
2
1
|
import type { Options as AcornOpts } from 'acorn';
|
|
3
2
|
import type { AstroConfig } from 'astro';
|
|
4
3
|
import matter from 'gray-matter';
|
|
5
4
|
import type { MdxjsEsm } from 'mdast-util-mdx';
|
|
5
|
+
import type { PluggableList } from 'unified';
|
|
6
6
|
interface FileInfo {
|
|
7
7
|
fileId: string;
|
|
8
8
|
fileUrl: string;
|
package/dist/utils.js
CHANGED
|
@@ -51,8 +51,8 @@ function jsToTreeNode(jsString, acornOpts = {
|
|
|
51
51
|
type: "mdxjsEsm",
|
|
52
52
|
value: "",
|
|
53
53
|
data: {
|
|
54
|
+
// @ts-expect-error `parse` return types is incompatible but it should work in runtime
|
|
54
55
|
estree: {
|
|
55
|
-
body: [],
|
|
56
56
|
...parse(jsString, acornOpts),
|
|
57
57
|
type: "Program",
|
|
58
58
|
sourceType: "module"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/mdx",
|
|
3
3
|
"description": "Add support for MDX pages in your Astro site",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0-beta.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -27,47 +27,47 @@
|
|
|
27
27
|
"template"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@mdx-js/mdx": "^
|
|
31
|
-
"acorn": "^8.
|
|
32
|
-
"es-module-lexer": "^1.
|
|
33
|
-
"estree-util-visit": "^
|
|
30
|
+
"@mdx-js/mdx": "^3.0.0",
|
|
31
|
+
"acorn": "^8.11.2",
|
|
32
|
+
"es-module-lexer": "^1.4.1",
|
|
33
|
+
"estree-util-visit": "^2.0.0",
|
|
34
34
|
"github-slugger": "^2.0.0",
|
|
35
35
|
"gray-matter": "^4.0.3",
|
|
36
|
-
"hast-util-to-html": "^
|
|
36
|
+
"hast-util-to-html": "^9.0.0",
|
|
37
37
|
"kleur": "^4.1.4",
|
|
38
|
-
"rehype-raw": "^
|
|
39
|
-
"remark-gfm": "^
|
|
38
|
+
"rehype-raw": "^7.0.0",
|
|
39
|
+
"remark-gfm": "^4.0.0",
|
|
40
40
|
"remark-smartypants": "^2.0.0",
|
|
41
41
|
"source-map": "^0.7.4",
|
|
42
|
-
"unist-util-visit": "^
|
|
43
|
-
"vfile": "^
|
|
44
|
-
"@astrojs/markdown-remark": "
|
|
42
|
+
"unist-util-visit": "^5.0.0",
|
|
43
|
+
"vfile": "^6.0.1",
|
|
44
|
+
"@astrojs/markdown-remark": "4.0.0-beta.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"astro": "^
|
|
47
|
+
"astro": "^4.0.0-beta.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@types/chai": "^4.3.
|
|
51
|
-
"@types/estree": "^1.0.
|
|
52
|
-
"@types/mdast": "^
|
|
53
|
-
"@types/mocha": "^10.0.
|
|
54
|
-
"@types/yargs-parser": "^21.0.
|
|
50
|
+
"@types/chai": "^4.3.10",
|
|
51
|
+
"@types/estree": "^1.0.5",
|
|
52
|
+
"@types/mdast": "^4.0.3",
|
|
53
|
+
"@types/mocha": "^10.0.4",
|
|
54
|
+
"@types/yargs-parser": "^21.0.3",
|
|
55
55
|
"chai": "^4.3.7",
|
|
56
56
|
"cheerio": "1.0.0-rc.12",
|
|
57
|
-
"linkedom": "^0.
|
|
58
|
-
"mdast-util-mdx": "^
|
|
59
|
-
"mdast-util-to-string": "^
|
|
57
|
+
"linkedom": "^0.16.4",
|
|
58
|
+
"mdast-util-mdx": "^3.0.0",
|
|
59
|
+
"mdast-util-to-string": "^4.0.0",
|
|
60
60
|
"mocha": "^10.2.0",
|
|
61
61
|
"reading-time": "^1.5.0",
|
|
62
|
-
"rehype-mathjax": "^
|
|
63
|
-
"rehype-pretty-code": "^0.10.
|
|
64
|
-
"remark-math": "^
|
|
65
|
-
"remark-rehype": "^
|
|
62
|
+
"rehype-mathjax": "^5.0.0",
|
|
63
|
+
"rehype-pretty-code": "^0.10.2",
|
|
64
|
+
"remark-math": "^6.0.0",
|
|
65
|
+
"remark-rehype": "^11.0.0",
|
|
66
66
|
"remark-shiki-twoslash": "^3.1.3",
|
|
67
|
-
"remark-toc": "^
|
|
68
|
-
"unified": "^
|
|
69
|
-
"vite": "^
|
|
70
|
-
"astro": "
|
|
67
|
+
"remark-toc": "^9.0.0",
|
|
68
|
+
"unified": "^11.0.4",
|
|
69
|
+
"vite": "^5.0.0",
|
|
70
|
+
"astro": "4.0.0-beta.0",
|
|
71
71
|
"astro-scripts": "0.0.14"
|
|
72
72
|
},
|
|
73
73
|
"engines": {
|