Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RemarkRehype types #9147

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/khaki-fans-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/markdown-remark': patch
---

Fixes `RemarkRehype` type's `handler` and `handlers` properties
1 change: 0 additions & 1 deletion packages/markdown/remark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/markdown/remark/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export async function createMarkdownProcessor(
}

// Remark -> Rehype
parser.use(remarkRehype as any, {
parser.use(remarkRehype, {
allowDangerousHtml: true,
passThrough: [],
...remarkRehypeOptions,
Expand Down
9 changes: 1 addition & 8 deletions packages/markdown/remark/src/types.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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 = {
Expand All @@ -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[];
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading