@astrojs/markdown-remark 0.8.2 → 0.8.3
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 -0
- package/CHANGELOG.md +0 -6
- package/dist/index.d.ts +16 -3
- package/dist/index.js +34 -4
- package/dist/load-plugins.d.ts +2 -1
- package/dist/rehype-collect-headers.d.ts +0 -0
- package/dist/rehype-escape.d.ts +0 -0
- package/dist/rehype-expressions.d.ts +0 -0
- package/dist/rehype-islands.d.ts +0 -0
- package/dist/rehype-jsx.d.ts +0 -0
- package/dist/remark-expressions.d.ts +0 -0
- package/dist/remark-jsx.d.ts +0 -0
- package/dist/remark-prism.d.ts +0 -0
- package/dist/remark-scoped-styles.d.ts +0 -0
- package/dist/remark-shiki.d.ts +28 -1
- package/dist/remark-shiki.js +1 -1
- package/dist/remark-slug.d.ts +0 -0
- package/dist/remark-unwrap.d.ts +0 -0
- package/dist/types.d.ts +9 -20
- package/package.json +2 -4
- package/src/index.ts +22 -6
- package/src/load-plugins.ts +2 -3
- package/src/remark-shiki.ts +29 -2
- package/src/types.ts +9 -31
- package/astrojs-markdown-remark-0.8.2.tgz +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
[33m@astrojs/markdown-remark:build: [0mcache hit, replaying output [2m5817ab166c77bc86[0m
|
|
2
|
+
[33m@astrojs/markdown-remark:build: [0m
|
|
3
|
+
[33m@astrojs/markdown-remark:build: [0m> @astrojs/markdown-remark@0.8.1 build /Users/fks/Code/astro/packages/markdown/remark
|
|
4
|
+
[33m@astrojs/markdown-remark:build: [0m> astro-scripts build "src/**/*.ts" && tsc -p tsconfig.json
|
|
5
|
+
[33m@astrojs/markdown-remark:build: [0m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
# @astrojs/markdown-remark
|
|
2
2
|
|
|
3
|
-
## 0.8.2
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- [#2970](https://github.com/withastro/astro/pull/2970) [`b835e285`](https://github.com/withastro/astro/commit/b835e285defb4f31fc5ac1039c7f607c07f3c00b) Thanks [@JuanM04](https://github.com/JuanM04)! - Improved type checking
|
|
8
|
-
|
|
9
3
|
## 0.8.1
|
|
10
4
|
|
|
11
5
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import type { MarkdownRenderingOptions } from './types';
|
|
2
|
-
export
|
|
1
|
+
import type { AstroMarkdownOptions, MarkdownRenderingOptions, ShikiConfig, Plugin } from './types';
|
|
2
|
+
export { AstroMarkdownOptions, MarkdownRenderingOptions, ShikiConfig, Plugin };
|
|
3
|
+
/** Internal utility for rendering a full markdown file and extracting Frontmatter data */
|
|
4
|
+
export declare function renderMarkdownWithFrontmatter(contents: string, opts?: MarkdownRenderingOptions | null): Promise<{
|
|
5
|
+
frontmatter: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
metadata: {
|
|
9
|
+
headers: any[];
|
|
10
|
+
source: string;
|
|
11
|
+
html: string;
|
|
12
|
+
};
|
|
13
|
+
code: string;
|
|
14
|
+
}>;
|
|
3
15
|
export declare const DEFAULT_REMARK_PLUGINS: string[];
|
|
4
16
|
export declare const DEFAULT_REHYPE_PLUGINS: string[];
|
|
5
17
|
/** Shared utility for rendering markdown */
|
|
6
|
-
export declare function renderMarkdown(content: string, opts
|
|
18
|
+
export declare function renderMarkdown(content: string, opts?: MarkdownRenderingOptions | null): Promise<{
|
|
7
19
|
metadata: {
|
|
8
20
|
headers: any[];
|
|
9
21
|
source: string;
|
|
@@ -11,3 +23,4 @@ export declare function renderMarkdown(content: string, opts: MarkdownRenderingO
|
|
|
11
23
|
};
|
|
12
24
|
code: string;
|
|
13
25
|
}>;
|
|
26
|
+
export default renderMarkdownWithFrontmatter;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1
20
|
import createCollectHeaders from "./rehype-collect-headers.js";
|
|
2
21
|
import scopedStyles from "./remark-scoped-styles.js";
|
|
3
22
|
import { remarkExpressions, loadRemarkExpressions } from "./remark-expressions.js";
|
|
@@ -15,13 +34,21 @@ import markdown from "remark-parse";
|
|
|
15
34
|
import markdownToHtml from "remark-rehype";
|
|
16
35
|
import rehypeStringify from "rehype-stringify";
|
|
17
36
|
import rehypeRaw from "rehype-raw";
|
|
18
|
-
|
|
37
|
+
import matter from "gray-matter";
|
|
38
|
+
async function renderMarkdownWithFrontmatter(contents, opts) {
|
|
39
|
+
const { data: frontmatter, content } = matter(contents);
|
|
40
|
+
const value = await renderMarkdown(content, opts);
|
|
41
|
+
return __spreadProps(__spreadValues({}, value), { frontmatter });
|
|
42
|
+
}
|
|
19
43
|
const DEFAULT_REMARK_PLUGINS = ["remark-gfm", "remark-smartypants"];
|
|
20
44
|
const DEFAULT_REHYPE_PLUGINS = ["rehype-slug"];
|
|
21
45
|
async function renderMarkdown(content, opts) {
|
|
22
46
|
var _a;
|
|
23
|
-
let {
|
|
24
|
-
const scopedClassName = (_a = opts.$) == null ? void 0 : _a.scopedClassName;
|
|
47
|
+
let { remarkPlugins = [], rehypePlugins = [] } = opts ?? {};
|
|
48
|
+
const scopedClassName = (_a = opts == null ? void 0 : opts.$) == null ? void 0 : _a.scopedClassName;
|
|
49
|
+
const mode = (opts == null ? void 0 : opts.mode) ?? "mdx";
|
|
50
|
+
const syntaxHighlight = (opts == null ? void 0 : opts.syntaxHighlight) ?? "shiki";
|
|
51
|
+
const shikiConfig = (opts == null ? void 0 : opts.shikiConfig) ?? {};
|
|
25
52
|
const isMDX = mode === "mdx";
|
|
26
53
|
const { headers, rehypeCollectHeaders } = createCollectHeaders();
|
|
27
54
|
await Promise.all([loadRemarkExpressions(), loadRemarkJsx()]);
|
|
@@ -69,8 +96,11 @@ async function renderMarkdown(content, opts) {
|
|
|
69
96
|
code: result.toString()
|
|
70
97
|
};
|
|
71
98
|
}
|
|
99
|
+
var src_default = renderMarkdownWithFrontmatter;
|
|
72
100
|
export {
|
|
73
101
|
DEFAULT_REHYPE_PLUGINS,
|
|
74
102
|
DEFAULT_REMARK_PLUGINS,
|
|
75
|
-
|
|
103
|
+
src_default as default,
|
|
104
|
+
renderMarkdown,
|
|
105
|
+
renderMarkdownWithFrontmatter
|
|
76
106
|
};
|
package/dist/load-plugins.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import * as unified from 'unified';
|
|
2
|
-
|
|
2
|
+
import type { Plugin } from './types';
|
|
3
|
+
export declare function loadPlugins(items: Plugin[]): Promise<[unified.Plugin, any?]>[];
|
|
File without changes
|
package/dist/rehype-escape.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/rehype-islands.d.ts
CHANGED
|
File without changes
|
package/dist/rehype-jsx.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/remark-jsx.d.ts
CHANGED
|
File without changes
|
package/dist/remark-prism.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/remark-shiki.d.ts
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as shiki from 'shiki';
|
|
2
|
+
export interface ShikiConfig {
|
|
3
|
+
/**
|
|
4
|
+
* The languages loaded to Shiki.
|
|
5
|
+
* Supports all languages listed here: https://github.com/shikijs/shiki/blob/main/docs/languages.md#all-languages
|
|
6
|
+
* Instructions for loading a custom language: https://github.com/shikijs/shiki/blob/main/docs/languages.md#supporting-your-own-languages-with-shiki
|
|
7
|
+
*
|
|
8
|
+
* @default []
|
|
9
|
+
*/
|
|
10
|
+
langs?: shiki.ILanguageRegistration[];
|
|
11
|
+
/**
|
|
12
|
+
* The styling theme.
|
|
13
|
+
* Supports all themes listed here: https://github.com/shikijs/shiki/blob/main/docs/themes.md#all-themes
|
|
14
|
+
* Instructions for loading a custom theme: https://github.com/shikijs/shiki/blob/main/docs/themes.md#loading-theme
|
|
15
|
+
*
|
|
16
|
+
* @default "github-dark"
|
|
17
|
+
*/
|
|
18
|
+
theme?: shiki.IThemeRegistration;
|
|
19
|
+
/**
|
|
20
|
+
* Enable word wrapping.
|
|
21
|
+
* - true: enabled.
|
|
22
|
+
* - false: enabled.
|
|
23
|
+
* - null: All overflow styling removed. Code will overflow the element by default.
|
|
24
|
+
*
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
wrap?: boolean | null;
|
|
28
|
+
}
|
|
2
29
|
declare const remarkShiki: ({ langs, theme, wrap }: ShikiConfig, scopedClassName?: string | null | undefined) => Promise<() => (tree: any) => void>;
|
|
3
30
|
export default remarkShiki;
|
package/dist/remark-shiki.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getHighlighter } from "shiki";
|
|
2
2
|
import { visit } from "unist-util-visit";
|
|
3
3
|
const highlighterCacheAsync = /* @__PURE__ */ new Map();
|
|
4
|
-
const remarkShiki = async ({ langs, theme, wrap }, scopedClassName) => {
|
|
4
|
+
const remarkShiki = async ({ langs = [], theme = "github-dark", wrap = false }, scopedClassName) => {
|
|
5
5
|
const cacheID = typeof theme === "string" ? theme : theme.name;
|
|
6
6
|
let highlighterAsync = highlighterCacheAsync.get(cacheID);
|
|
7
7
|
if (!highlighterAsync) {
|
package/dist/remark-slug.d.ts
CHANGED
|
File without changes
|
package/dist/remark-unwrap.d.ts
CHANGED
|
File without changes
|
package/dist/types.d.ts
CHANGED
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
import type * as unified from 'unified';
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export type { Node } from 'unist';
|
|
6
|
-
export declare type RemarkPlugin<PluginParameters extends any[] = any[]> = unified.Plugin<PluginParameters, mdast.Root>;
|
|
7
|
-
export declare type RemarkPlugins = (string | [string, any] | RemarkPlugin | [RemarkPlugin, any])[];
|
|
8
|
-
export declare type RehypePlugin<PluginParameters extends any[] = any[]> = unified.Plugin<PluginParameters, hast.Root>;
|
|
9
|
-
export declare type RehypePlugins = (string | [string, any] | RehypePlugin | [RehypePlugin, any])[];
|
|
10
|
-
export interface ShikiConfig {
|
|
11
|
-
langs: ILanguageRegistration[];
|
|
12
|
-
theme: Theme | IThemeRegistration;
|
|
13
|
-
wrap: boolean | null;
|
|
14
|
-
}
|
|
2
|
+
import type { ShikiConfig } from './remark-shiki';
|
|
3
|
+
export { ShikiConfig };
|
|
4
|
+
export declare type Plugin = string | [string, any] | unified.Plugin | [unified.Plugin, any];
|
|
15
5
|
export interface AstroMarkdownOptions {
|
|
16
|
-
mode
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
rehypePlugins: RehypePlugins;
|
|
6
|
+
mode?: 'md' | 'mdx';
|
|
7
|
+
syntaxHighlight?: 'shiki' | 'prism' | false;
|
|
8
|
+
shikiConfig?: ShikiConfig;
|
|
9
|
+
remarkPlugins?: Plugin[];
|
|
10
|
+
rehypePlugins?: Plugin[];
|
|
22
11
|
}
|
|
23
|
-
export interface MarkdownRenderingOptions extends AstroMarkdownOptions {
|
|
12
|
+
export interface MarkdownRenderingOptions extends Partial<AstroMarkdownOptions> {
|
|
24
13
|
/** @internal */
|
|
25
14
|
$?: {
|
|
26
15
|
scopedClassName: string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/markdown-remark",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "withastro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"@astrojs/prism": "^0.4.1",
|
|
27
27
|
"assert": "^2.0.0",
|
|
28
28
|
"github-slugger": "^1.4.0",
|
|
29
|
+
"gray-matter": "^4.0.3",
|
|
29
30
|
"mdast-util-mdx-expression": "^1.2.0",
|
|
30
31
|
"mdast-util-mdx-jsx": "^1.2.0",
|
|
31
32
|
"mdast-util-to-string": "^3.1.0",
|
|
@@ -46,10 +47,7 @@
|
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@types/github-slugger": "^1.3.0",
|
|
49
|
-
"@types/hast": "^2.3.4",
|
|
50
|
-
"@types/mdast": "^3.0.10",
|
|
51
50
|
"@types/prismjs": "^1.26.0",
|
|
52
|
-
"@types/unist": "^2.0.6",
|
|
53
51
|
"astro-scripts": "workspace:*"
|
|
54
52
|
}
|
|
55
53
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MarkdownRenderingOptions } from './types';
|
|
1
|
+
import type { AstroMarkdownOptions, MarkdownRenderingOptions, ShikiConfig, Plugin } from './types';
|
|
2
2
|
|
|
3
3
|
import createCollectHeaders from './rehype-collect-headers.js';
|
|
4
4
|
import scopedStyles from './remark-scoped-styles.js';
|
|
@@ -18,17 +18,31 @@ import markdown from 'remark-parse';
|
|
|
18
18
|
import markdownToHtml from 'remark-rehype';
|
|
19
19
|
import rehypeStringify from 'rehype-stringify';
|
|
20
20
|
import rehypeRaw from 'rehype-raw';
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
import matter from 'gray-matter';
|
|
22
|
+
|
|
23
|
+
export { AstroMarkdownOptions, MarkdownRenderingOptions, ShikiConfig, Plugin };
|
|
24
|
+
|
|
25
|
+
/** Internal utility for rendering a full markdown file and extracting Frontmatter data */
|
|
26
|
+
export async function renderMarkdownWithFrontmatter(
|
|
27
|
+
contents: string,
|
|
28
|
+
opts?: MarkdownRenderingOptions | null
|
|
29
|
+
) {
|
|
30
|
+
const { data: frontmatter, content } = matter(contents);
|
|
31
|
+
const value = await renderMarkdown(content, opts);
|
|
32
|
+
return { ...value, frontmatter };
|
|
33
|
+
}
|
|
23
34
|
|
|
24
35
|
export const DEFAULT_REMARK_PLUGINS = ['remark-gfm', 'remark-smartypants'];
|
|
25
36
|
|
|
26
37
|
export const DEFAULT_REHYPE_PLUGINS = ['rehype-slug'];
|
|
27
38
|
|
|
28
39
|
/** Shared utility for rendering markdown */
|
|
29
|
-
export async function renderMarkdown(content: string, opts
|
|
30
|
-
let {
|
|
31
|
-
const scopedClassName = opts
|
|
40
|
+
export async function renderMarkdown(content: string, opts?: MarkdownRenderingOptions | null) {
|
|
41
|
+
let { remarkPlugins = [], rehypePlugins = [] } = opts ?? {};
|
|
42
|
+
const scopedClassName = opts?.$?.scopedClassName;
|
|
43
|
+
const mode = opts?.mode ?? 'mdx';
|
|
44
|
+
const syntaxHighlight = opts?.syntaxHighlight ?? 'shiki';
|
|
45
|
+
const shikiConfig = opts?.shikiConfig ?? {};
|
|
32
46
|
const isMDX = mode === 'mdx';
|
|
33
47
|
const { headers, rehypeCollectHeaders } = createCollectHeaders();
|
|
34
48
|
|
|
@@ -97,3 +111,5 @@ export async function renderMarkdown(content: string, opts: MarkdownRenderingOpt
|
|
|
97
111
|
code: result.toString(),
|
|
98
112
|
};
|
|
99
113
|
}
|
|
114
|
+
|
|
115
|
+
export default renderMarkdownWithFrontmatter;
|
package/src/load-plugins.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as unified from 'unified';
|
|
2
|
+
import type { Plugin } from './types';
|
|
2
3
|
|
|
3
4
|
async function importPlugin(p: string | unified.Plugin): Promise<unified.Plugin> {
|
|
4
5
|
if (typeof p === 'string') {
|
|
@@ -9,9 +10,7 @@ async function importPlugin(p: string | unified.Plugin): Promise<unified.Plugin>
|
|
|
9
10
|
return p;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
export function loadPlugins(
|
|
13
|
-
items: (string | [string, any] | unified.Plugin<any[], any> | [unified.Plugin<any[], any>, any])[]
|
|
14
|
-
): Promise<[unified.Plugin, any?]>[] {
|
|
13
|
+
export function loadPlugins(items: Plugin[]): Promise<[unified.Plugin, any?]>[] {
|
|
15
14
|
return items.map((p) => {
|
|
16
15
|
return new Promise((resolve, reject) => {
|
|
17
16
|
if (Array.isArray(p)) {
|
package/src/remark-shiki.ts
CHANGED
|
@@ -1,7 +1,34 @@
|
|
|
1
1
|
import type * as shiki from 'shiki';
|
|
2
2
|
import { getHighlighter } from 'shiki';
|
|
3
3
|
import { visit } from 'unist-util-visit';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
export interface ShikiConfig {
|
|
6
|
+
/**
|
|
7
|
+
* The languages loaded to Shiki.
|
|
8
|
+
* Supports all languages listed here: https://github.com/shikijs/shiki/blob/main/docs/languages.md#all-languages
|
|
9
|
+
* Instructions for loading a custom language: https://github.com/shikijs/shiki/blob/main/docs/languages.md#supporting-your-own-languages-with-shiki
|
|
10
|
+
*
|
|
11
|
+
* @default []
|
|
12
|
+
*/
|
|
13
|
+
langs?: shiki.ILanguageRegistration[];
|
|
14
|
+
/**
|
|
15
|
+
* The styling theme.
|
|
16
|
+
* Supports all themes listed here: https://github.com/shikijs/shiki/blob/main/docs/themes.md#all-themes
|
|
17
|
+
* Instructions for loading a custom theme: https://github.com/shikijs/shiki/blob/main/docs/themes.md#loading-theme
|
|
18
|
+
*
|
|
19
|
+
* @default "github-dark"
|
|
20
|
+
*/
|
|
21
|
+
theme?: shiki.IThemeRegistration;
|
|
22
|
+
/**
|
|
23
|
+
* Enable word wrapping.
|
|
24
|
+
* - true: enabled.
|
|
25
|
+
* - false: enabled.
|
|
26
|
+
* - null: All overflow styling removed. Code will overflow the element by default.
|
|
27
|
+
*
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
wrap?: boolean | null;
|
|
31
|
+
}
|
|
5
32
|
|
|
6
33
|
/**
|
|
7
34
|
* getHighlighter() is the most expensive step of Shiki. Instead of calling it on every page,
|
|
@@ -11,7 +38,7 @@ import type { ShikiConfig } from './types.js';
|
|
|
11
38
|
const highlighterCacheAsync = new Map<string, Promise<shiki.Highlighter>>();
|
|
12
39
|
|
|
13
40
|
const remarkShiki = async (
|
|
14
|
-
{ langs, theme, wrap }: ShikiConfig,
|
|
41
|
+
{ langs = [], theme = 'github-dark', wrap = false }: ShikiConfig,
|
|
15
42
|
scopedClassName?: string | null
|
|
16
43
|
) => {
|
|
17
44
|
const cacheID: string = typeof theme === 'string' ? theme : theme.name;
|
package/src/types.ts
CHANGED
|
@@ -1,40 +1,18 @@
|
|
|
1
1
|
import type * as unified from 'unified';
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
import type { ILanguageRegistration, IThemeRegistration, Theme } from 'shiki';
|
|
2
|
+
import type { ShikiConfig } from './remark-shiki';
|
|
3
|
+
export { ShikiConfig };
|
|
5
4
|
|
|
6
|
-
export type
|
|
7
|
-
|
|
8
|
-
export type RemarkPlugin<PluginParameters extends any[] = any[]> = unified.Plugin<
|
|
9
|
-
PluginParameters,
|
|
10
|
-
mdast.Root
|
|
11
|
-
>;
|
|
12
|
-
|
|
13
|
-
export type RemarkPlugins = (string | [string, any] | RemarkPlugin | [RemarkPlugin, any])[];
|
|
14
|
-
|
|
15
|
-
export type RehypePlugin<PluginParameters extends any[] = any[]> = unified.Plugin<
|
|
16
|
-
PluginParameters,
|
|
17
|
-
hast.Root
|
|
18
|
-
>;
|
|
19
|
-
|
|
20
|
-
export type RehypePlugins = (string | [string, any] | RehypePlugin | [RehypePlugin, any])[];
|
|
21
|
-
|
|
22
|
-
export interface ShikiConfig {
|
|
23
|
-
langs: ILanguageRegistration[];
|
|
24
|
-
theme: Theme | IThemeRegistration;
|
|
25
|
-
wrap: boolean | null;
|
|
26
|
-
}
|
|
5
|
+
export type Plugin = string | [string, any] | unified.Plugin | [unified.Plugin, any];
|
|
27
6
|
|
|
28
7
|
export interface AstroMarkdownOptions {
|
|
29
|
-
mode
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
rehypePlugins: RehypePlugins;
|
|
8
|
+
mode?: 'md' | 'mdx';
|
|
9
|
+
syntaxHighlight?: 'shiki' | 'prism' | false;
|
|
10
|
+
shikiConfig?: ShikiConfig;
|
|
11
|
+
remarkPlugins?: Plugin[];
|
|
12
|
+
rehypePlugins?: Plugin[];
|
|
35
13
|
}
|
|
36
14
|
|
|
37
|
-
export interface MarkdownRenderingOptions extends AstroMarkdownOptions {
|
|
15
|
+
export interface MarkdownRenderingOptions extends Partial<AstroMarkdownOptions> {
|
|
38
16
|
/** @internal */
|
|
39
17
|
$?: {
|
|
40
18
|
scopedClassName: string | null;
|
|
Binary file
|