Skip to content

Commit 3237d0c

Browse files
docs: note rehype slug is needed with autolink headings
resolves: GH-4
1 parent d588f80 commit 3237d0c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

readme.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ relevant links: [markdown](https://commonmark.org), [remark](https://github.com/
145145
import React, { Fragment } from 'react';
146146
import { useRemark } from '@christianmurphy/react-remark';
147147
import remarkGemoji from 'remark-gemoji';
148+
import rehypeSlug from 'rehype-slug';
148149
import rehypeAutoLinkHeadings from 'rehype-autolink-headings';
149150

150151
// ...
@@ -153,7 +154,7 @@ const [reactContent, setMarkdownSource] = useRemark({
153154
remarkParseOptions: { commonmark: true },
154155
remarkPlugins: [remarkGemoji],
155156
remarkToRehypeOptions: { commonmark: true },
156-
rehypePlugins: [rehypeAutoLinkHeadings],
157+
rehypePlugins: [rehypeSlug, rehypeAutoLinkHeadings],
157158
rehypeReactOptions: {
158159
components: {
159160
p: props => <p className="custom-paragraph" {...props} />,
@@ -168,6 +169,7 @@ const [reactContent, setMarkdownSource] = useRemark({
168169
import React, { Fragment } from 'react';
169170
import { useRemark } from '@christianmurphy/react-remark';
170171
import remarkGemoji from 'remark-gemoji';
172+
import rehypeSlug from 'rehype-slug';
171173
import rehypeAutoLinkHeadings from 'rehype-autolink-headings';
172174

173175
// ...
@@ -176,7 +178,7 @@ import rehypeAutoLinkHeadings from 'rehype-autolink-headings';
176178
remarkParseOptions={{ commonmark: true }}
177179
remarkPlugins={[remarkGemoji]}
178180
remarkToRehypeOptions={{ commonmark: true }}
179-
rehypePlugins={[rehypeAutoLinkHeadings]}
181+
rehypePlugins={[rehypeSlug, rehypeAutoLinkHeadings]}
180182
rehypeReactOptions={{
181183
components: {
182184
p: props => <p className="custom-paragraph" {...props} />,

0 commit comments

Comments
 (0)