summaryrefslogtreecommitdiff
path: root/packages/markdown/remark/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/markdown/remark/src')
-rw-r--r--packages/markdown/remark/src/index.ts2
-rw-r--r--packages/markdown/remark/src/types.ts10
2 files changed, 12 insertions, 0 deletions
diff --git a/packages/markdown/remark/src/index.ts b/packages/markdown/remark/src/index.ts
index a50b3ad19..da64a5459 100644
--- a/packages/markdown/remark/src/index.ts
+++ b/packages/markdown/remark/src/index.ts
@@ -38,6 +38,7 @@ export async function renderMarkdown(
shikiConfig = {},
remarkPlugins = [],
rehypePlugins = [],
+ remarkRehype = {},
isAstroFlavoredMd = false,
} = opts;
const input = new VFile({ value: content, path: fileURL });
@@ -85,6 +86,7 @@ export async function renderMarkdown(
'mdxTextExpression',
]
: [],
+ ...remarkRehype,
},
],
]);
diff --git a/packages/markdown/remark/src/types.ts b/packages/markdown/remark/src/types.ts
index 3569e8d04..bf3d10904 100644
--- a/packages/markdown/remark/src/types.ts
+++ b/packages/markdown/remark/src/types.ts
@@ -1,6 +1,11 @@
import type * as hast from 'hast';
import type * as mdast from 'mdast';
import type { ILanguageRegistration, IThemeRegistration, Theme } from 'shiki';
+import type {
+ Options as RemarkRehypeOptions,
+ all as Handlers,
+ one as Handler,
+} from 'remark-rehype';
import type * as unified from 'unified';
import type { VFile } from 'vfile';
@@ -20,6 +25,10 @@ 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: typeof Handlers;
+} & { handler: typeof Handler };
+
export interface ShikiConfig {
langs?: ILanguageRegistration[];
theme?: Theme | IThemeRegistration;
@@ -33,6 +42,7 @@ export interface AstroMarkdownOptions {
shikiConfig?: ShikiConfig;
remarkPlugins?: RemarkPlugins;
rehypePlugins?: RehypePlugins;
+ remarkRehype?: RemarkRehype;
}
export interface MarkdownRenderingOptions extends AstroMarkdownOptions {