Skip to content

Commit

Permalink
type: Fix rewrite type.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Oct 4, 2021
1 parent 8ab4158 commit a6d0611
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Plugin } from 'unified';
import { Root, Element, ElementContent } from 'hast';
import { Root, Element, RootContent } from 'hast';
import { visit } from 'unist-util-visit';
import { selectAll } from 'hast-util-select';
import { Test } from 'unist-util-is';

export type RehypeRewriteOptions = {
selector?: string;
rewrite(node: ElementContent, index: number | null, parent: Root | Element | null): void;
rewrite(node: Root | RootContent, index: number | null, parent: Root | Element | null): void;
}

const remarkRewrite: Plugin<[RehypeRewriteOptions?], Root> = (options) => {
Expand All @@ -23,7 +23,7 @@ const remarkRewrite: Plugin<[RehypeRewriteOptions?], Root> = (options) => {
return;
}

visit(tree, (node: ElementContent, index, parent) => {
visit(tree, (node: Root | RootContent, index, parent) => {
rewrite(node, index, parent);
});
}
Expand Down

0 comments on commit a6d0611

Please sign in to comment.