Skip to content

Commit d182844

Browse files
committed
Add rehype-slug for same page linking
1 parent 7587f5e commit d182844

File tree

5 files changed

+79
-26
lines changed

5 files changed

+79
-26
lines changed

site/next.config.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
const withTM = require('next-transpile-modules')(['react-hot-toast']);
2+
const remarkSlugs = require('rehype-slug');
3+
24
const withMDX = require('@next/mdx')({
3-
extension: /\.mdx?$/,
5+
extension: /.mdx?$/,
6+
options: {
7+
rehypePlugins: [remarkSlugs],
8+
},
49
});
510
const withPlugins = require('next-compose-plugins');
611

712
const withSvgr = (nextConfig = {}, nextComposePlugins = {}) => {
813
return Object.assign({}, nextConfig, {
914
webpack(config, options) {
1015
config.module.rules.push({
11-
test: /\.svg$/,
16+
test: /.svg$/,
1217
use: ['@svgr/webpack'],
1318
});
1419

site/package-lock.json

Lines changed: 45 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"react": "^17.0.1",
2121
"react-dom": "^17.0.1",
2222
"react-hot-toast": "file:../",
23+
"rehype-slug": "^4.0.1",
2324
"tailwindcss": "^2.1.2"
2425
},
2526
"devDependencies": {

site/pages/docs/toast.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ toast('Hello World', {
4646
toast('Hello World');
4747
```
4848

49-
The most basic variant. It does not have an icon by default, but you can provide one via the options.
49+
The most basic variant. It does not have an icon by default, but you can provide one via the options. If you don't want any default styles, use `toast.custom()` instead.
5050

5151
### Success
5252

@@ -78,7 +78,7 @@ Creates a custom notification with JSX without default styles.
7878
toast.loading('Waiting...');
7979
```
8080

81-
This will create a loading notification. Most likely, you want to update it manually afterwards. For a friendly alternative, check out `toast.promise()`, which takes care of that automatically.
81+
This will create a loading notification. Most likely, you want to update it afterwards. For a friendly alternative, check out `toast.promise()`, which takes care of that automatically.
8282

8383
### Promise
8484

@@ -153,19 +153,19 @@ You can dismiss all toasts at once, by leaving out the `toastId`.
153153
#### Dismiss all toasts at one
154154

155155
```js
156-
toast.dismiss()
156+
toast.dismiss();
157157
```
158158

159159
To remove toasts instantly without any animations, use `toast.remove`.
160160

161161
#### Remove toasts instanstly
162162

163163
```js
164-
toast.remove(toastId)
164+
toast.remove(toastId);
165165

166166
// or
167167

168-
toast.remove()
168+
toast.remove();
169169
```
170170

171171
### Update an existing toast

site/pages/docs/version-2.mdx

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,37 @@ export default ({ children, meta }) => <Layout meta={meta}>{children}</Layout>;
1111

1212
This release is all about **flexibility**. It allows you to create the notification system of your dreams, even simpler. Before we dig deeper into the new APIs, check out what's included in this release:
1313

14-
<div className="text-lg">
15-
<span style={{ margin: '10px' }}>✨</span> <span className="font-semibold">toast.custom()</span> <span className="text-toast-700">- Dispatch components as toast</span>
14+
<div className="">
15+
<span style={{ margin: '10px' }}>✨</span> <a href="#introducing-toastcustom" className="font-semibold">toast.custom()</a> <span className="">- Dispatch components as toast</span>
1616
<br />
1717

18-
<span style={{ margin: '10px' }}>👀</span> <span className="font-semibold">
18+
<span style={{ margin: '10px' }}>👀</span> <a
19+
href="#better-accessibility"
20+
className="font-semibold"
21+
>
1922
Reduced-motion support
20-
</span> <span className="text-toast-700">
21-
- Automatically adapts to system preference
22-
</span>
23+
</a> <span className="">- Automatically adapts to system preference</span>
2324
<br />
2425

25-
<span style={{ margin: '10px' }}>🔀</span> <span className="font-semibold">
26+
<span style={{ margin: '10px' }}>🔀</span> <a
27+
href="#per-toast-positioning"
28+
className="font-semibold"
29+
>
2630
Individually position toasts{' '}
27-
</span> <span className="text-toast-700"></span>
31+
</a> <span className=""></span>
2832
<br />
29-
<span style={{ margin: '10px' }}>
30-
🧈
31-
</span> <span className="font-semibold">Smoother exit animations</span> <span className="text-toast-700"></span>
33+
<span style={{ margin: '10px' }}>🧈</span> <a
34+
href="#smoother-exit-animation"
35+
className="font-semibold"
36+
>
37+
Smoother exit animations
38+
</a> <span className=""></span>
3239
<br />
3340

34-
<span style={{ margin: '10px' }}>⚙️</span> <span className="font-semibold">Custom Renderer API</span> <span className="text-toast-700">- Supply your own render function</span>
41+
<span style={{ margin: '10px' }}>⚙️</span> <a href="#custom-renderer-api" className="font-semibold">Custom Renderer API</a> <span className="">- Supply your own render function</span>
3542
</div>
3643

37-
As well as a many other improvements and fixes.
44+
As well as a many [other improvements and fixes](#changelog).
3845

3946
## Introducing `toast.custom()`
4047

@@ -136,7 +143,7 @@ The offset is now controlled by the Toaster and can be changed by overwriting th
136143

137144
## Custom Renderer API
138145

139-
You can now use the [`<Toaster/>`](/docs/toaster) to render your own components. Pass in a function that receives a [Toast](https://github.com/timolins/react-hot-toast/blob/main/src/core/types.ts#L34) as the first argument, allowing you to render whatever you please.
146+
You can now use the [`<Toaster/>`](/docs/toaster#using-a-custom-render-function) to render your own components. Pass in a function that receives a [Toast](https://github.com/timolins/react-hot-toast/blob/main/src/core/types.ts#L34) as the first argument, allowing you to render whatever you please.
140147

141148
This is a great alternative if you are using [`useToaster()`](/docs/use-toaster) to render create custom notfications.
142149

0 commit comments

Comments
 (0)