Skip to content

Commit

Permalink
type: Update type document.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Oct 4, 2021
1 parent 02669ee commit bd5b2d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rehype-rewrite
---
===

[![Downloads](https://img.shields.io/npm/dm/rehype-rewrite.svg?style=flat)](https://www.npmjs.com/package/rehype-rewrite)
[![NPM version](https://img.shields.io/npm/v/rehype-rewrite.svg?style=flat)](https://npmjs.org/package/rehype-rewrite)
Expand Down Expand Up @@ -59,15 +59,14 @@ const htmlStr = rehype()
> ```
>

## Options

```ts
import { Plugin } from 'unified';
import { Root, Element, ElementContent } from 'hast';
export declare type RehypeRewriteOptions = {
selector?: string;
rewrite(node: ElementContent, index: number | null, parent: Root | Element | null): void;
selector?: string;
rewrite(node: ElementContent, index: number | null, parent: Root | Element | null): void;
};
declare const remarkRewrite: Plugin<[RehypeRewriteOptions?], Root>;
export default remarkRewrite;
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import { selectAll } from 'hast-util-select';
import { Test } from 'unist-util-is';

export type RehypeRewriteOptions = {
/**
* Select an element to be wrapped. Expects a string selector that can be passed to hast-util-select ([supported selectors](https://github.com/syntax-tree/hast-util-select/blob/master/readme.md#support)).
* If `selector` is not set then wrap will check for a body all elements.
*/
selector?: string;
/** Rewrite Element. */
rewrite(node: Root | RootContent, index: number | null, parent: Root | Element | null): void;
}

Expand Down

0 comments on commit bd5b2d7

Please sign in to comment.