diff options
author | 2023-11-22 11:17:29 +0800 | |
---|---|---|
committer | 2023-11-22 11:17:29 +0800 | |
commit | addb57c8e80b7b67ec61224666f3a1db5c44410c (patch) | |
tree | cd7b774bee374a361ce4a4bf053db9d82c9b985f /packages/markdown | |
parent | 0fe3a7ed5d7bb1a9fce1623e84ba14104b51223c (diff) | |
download | astro-addb57c8e80b7b67ec61224666f3a1db5c44410c.tar.gz astro-addb57c8e80b7b67ec61224666f3a1db5c44410c.tar.zst astro-addb57c8e80b7b67ec61224666f3a1db5c44410c.zip |
Fix RemarkRehype types (#9147)
Diffstat (limited to 'packages/markdown')
-rw-r--r-- | packages/markdown/remark/package.json | 1 | ||||
-rw-r--r-- | packages/markdown/remark/src/index.ts | 2 | ||||
-rw-r--r-- | packages/markdown/remark/src/types.ts | 9 |
3 files changed, 2 insertions, 10 deletions
diff --git a/packages/markdown/remark/package.json b/packages/markdown/remark/package.json index b465ec4f2..5bae632fc 100644 --- a/packages/markdown/remark/package.json +++ b/packages/markdown/remark/package.json @@ -35,7 +35,6 @@ "github-slugger": "^2.0.0", "import-meta-resolve": "^4.0.0", "mdast-util-definitions": "^6.0.0", - "mdast-util-to-hast": "13.0.2", "rehype-raw": "^7.0.0", "rehype-stringify": "^10.0.0", "remark-gfm": "^4.0.0", diff --git a/packages/markdown/remark/src/index.ts b/packages/markdown/remark/src/index.ts index a60ab88c0..d42ce480c 100644 --- a/packages/markdown/remark/src/index.ts +++ b/packages/markdown/remark/src/index.ts @@ -102,7 +102,7 @@ export async function createMarkdownProcessor( } // Remark -> Rehype - parser.use(remarkRehype as any, { + parser.use(remarkRehype, { allowDangerousHtml: true, passThrough: [], ...remarkRehypeOptions, diff --git a/packages/markdown/remark/src/types.ts b/packages/markdown/remark/src/types.ts index d0a6a13c2..b25e92271 100644 --- a/packages/markdown/remark/src/types.ts +++ b/packages/markdown/remark/src/types.ts @@ -1,7 +1,6 @@ import type * as hast from 'hast'; import type * as mdast from 'mdast'; import type { Options as RemarkRehypeOptions } from 'remark-rehype'; -import type { State } from 'mdast-util-to-hast'; import type { BuiltinTheme, LanguageRegistration, @@ -11,9 +10,6 @@ import type { import type * as unified from 'unified'; import type { VFile } from 'vfile'; -type Handler = State['one']; -type Handlers = State['all']; - export type { Node } from 'unist'; export type MarkdownAstroData = { @@ -34,10 +30,7 @@ export type RehypePlugin<PluginParameters extends any[] = any[]> = unified.Plugi export type RehypePlugins = (string | [string, any] | RehypePlugin | [RehypePlugin, any])[]; -export type RemarkRehype = Omit<RemarkRehypeOptions, 'handlers' | 'unknownHandler'> & { - handlers?: Handlers; - handler?: Handler; -}; +export type RemarkRehype = RemarkRehypeOptions; export interface ShikiConfig { langs?: LanguageRegistration[]; |