mirror of
https://github.com/withastro/astro.git
synced 2024-12-30 22:03:56 -05:00
Fix RemarkRehype types (#9147)
This commit is contained in:
parent
0fe3a7ed5d
commit
addb57c8e8
5 changed files with 7 additions and 13 deletions
5
.changeset/khaki-fans-sell.md
Normal file
5
.changeset/khaki-fans-sell.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@astrojs/markdown-remark': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixes `RemarkRehype` type's `handler` and `handlers` properties
|
|
@ -35,7 +35,6 @@
|
||||||
"github-slugger": "^2.0.0",
|
"github-slugger": "^2.0.0",
|
||||||
"import-meta-resolve": "^4.0.0",
|
"import-meta-resolve": "^4.0.0",
|
||||||
"mdast-util-definitions": "^6.0.0",
|
"mdast-util-definitions": "^6.0.0",
|
||||||
"mdast-util-to-hast": "13.0.2",
|
|
||||||
"rehype-raw": "^7.0.0",
|
"rehype-raw": "^7.0.0",
|
||||||
"rehype-stringify": "^10.0.0",
|
"rehype-stringify": "^10.0.0",
|
||||||
"remark-gfm": "^4.0.0",
|
"remark-gfm": "^4.0.0",
|
||||||
|
|
|
@ -102,7 +102,7 @@ export async function createMarkdownProcessor(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remark -> Rehype
|
// Remark -> Rehype
|
||||||
parser.use(remarkRehype as any, {
|
parser.use(remarkRehype, {
|
||||||
allowDangerousHtml: true,
|
allowDangerousHtml: true,
|
||||||
passThrough: [],
|
passThrough: [],
|
||||||
...remarkRehypeOptions,
|
...remarkRehypeOptions,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import type * as hast from 'hast';
|
import type * as hast from 'hast';
|
||||||
import type * as mdast from 'mdast';
|
import type * as mdast from 'mdast';
|
||||||
import type { Options as RemarkRehypeOptions } from 'remark-rehype';
|
import type { Options as RemarkRehypeOptions } from 'remark-rehype';
|
||||||
import type { State } from 'mdast-util-to-hast';
|
|
||||||
import type {
|
import type {
|
||||||
BuiltinTheme,
|
BuiltinTheme,
|
||||||
LanguageRegistration,
|
LanguageRegistration,
|
||||||
|
@ -11,9 +10,6 @@ import type {
|
||||||
import type * as unified from 'unified';
|
import type * as unified from 'unified';
|
||||||
import type { VFile } from 'vfile';
|
import type { VFile } from 'vfile';
|
||||||
|
|
||||||
type Handler = State['one'];
|
|
||||||
type Handlers = State['all'];
|
|
||||||
|
|
||||||
export type { Node } from 'unist';
|
export type { Node } from 'unist';
|
||||||
|
|
||||||
export type MarkdownAstroData = {
|
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 RehypePlugins = (string | [string, any] | RehypePlugin | [RehypePlugin, any])[];
|
||||||
|
|
||||||
export type RemarkRehype = Omit<RemarkRehypeOptions, 'handlers' | 'unknownHandler'> & {
|
export type RemarkRehype = RemarkRehypeOptions;
|
||||||
handlers?: Handlers;
|
|
||||||
handler?: Handler;
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface ShikiConfig {
|
export interface ShikiConfig {
|
||||||
langs?: LanguageRegistration[];
|
langs?: LanguageRegistration[];
|
||||||
|
|
|
@ -4905,9 +4905,6 @@ importers:
|
||||||
mdast-util-definitions:
|
mdast-util-definitions:
|
||||||
specifier: ^6.0.0
|
specifier: ^6.0.0
|
||||||
version: 6.0.0
|
version: 6.0.0
|
||||||
mdast-util-to-hast:
|
|
||||||
specifier: 13.0.2
|
|
||||||
version: 13.0.2
|
|
||||||
rehype-raw:
|
rehype-raw:
|
||||||
specifier: ^7.0.0
|
specifier: ^7.0.0
|
||||||
version: 7.0.0
|
version: 7.0.0
|
||||||
|
|
Loading…
Reference in a new issue