Skip to content

Commit 45cb9ef

Browse files
committed
doc: Update README.md
1 parent a6a9ddd commit 45cb9ef

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ React Markdown Preview
55
[![Build and Deploy](https://github.com/uiwjs/react-markdown-preview/actions/workflows/ci.marster.yml/badge.svg)](https://github.com/uiwjs/react-markdown-preview/actions/workflows/ci.marster.yml)
66
[![jsDelivr CDN](https://data.jsdelivr.com/v1/package/npm/@uiw/react-markdown-preview/badge?style=rounded)](https://www.jsdelivr.com/package/npm/@uiw/react-markdown-preview)
77
[![Downloads](https://img.shields.io/npm/dm/@uiw/react-markdown-preview.svg?style=flat)](https://www.npmjs.com/package/@uiw/react-markdown-preview)
8-
[![Coverage Status](https://uiwjs.github.io/react-markdown-preview/badges.svg)](https://uiwjs.github.io/react-markdown-preview/coverage/lcov-report/)
8+
[![Coverage Status](https://uiwjs.github.io/react-markdown-preview/badge.svg)](https://uiwjs.github.io/react-markdown-preview/coverage/lcov-report/)
99
[![npm version](https://img.shields.io/npm/v/@uiw/react-markdown-preview.svg)](https://www.npmjs.com/package/@uiw/react-markdown-preview)
1010
[![npm unpkg](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-markdown-preview/file/README.md)
1111

@@ -46,6 +46,33 @@ function Demo() {
4646
}
4747
```
4848

49+
## Disable Header links
50+
51+
```js test:meta
52+
import MarkdownPreview from '@uiw/react-markdown-preview';
53+
54+
const source = `
55+
## MarkdownPreview
56+
57+
## Header 2
58+
59+
### Header 3
60+
`;
61+
62+
function Demo() {
63+
return (
64+
<MarkdownPreview
65+
source={source}
66+
rehypeRewrite={(node, index, parent) => {
67+
if (node.tagName === "a" && parent && /^h(1|2|3|4|5|6)/.test(parent.tagName)) {
68+
parent.children = [parent.children[1]];
69+
}
70+
}}
71+
/>
72+
);
73+
}
74+
```
75+
4976
### Options Props
5077

5178
```typescript

0 commit comments

Comments
 (0)