Skip to content

Commit 38a8f6e

Browse files
committed
doc: Update README.md
1 parent a53be1e commit 38a8f6e

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,28 @@ Here is a simple footnote[^1]. With some additional text after it.
142142

143143
## Support dark-mode/night-mode
144144

145-
By default, the `dark-mode` is automatically switched according to the system. If you need to switch manually, just set the `data-color-mode="dark"` parameter for body.
145+
By default, the [`dark-mode`](https://github.com/jaywcjlove/dark-mode/) is automatically switched according to the system. If you need to switch manually, just set the `data-color-mode="dark"` parameter for body.
146146

147147
```html
148-
<body data-color-mode="dark"></body>
148+
<html data-color-mode="dark">
149149
```
150150

151151
```js
152-
document.body.setAttribute('data-color-mode', 'dark')
153-
document.body.setAttribute('data-color-mode', 'light')
152+
document.documentElement.setAttribute('data-color-mode', 'dark')
153+
document.documentElement.setAttribute('data-color-mode', 'light')
154+
```
155+
156+
Inherit custom color variables by adding [`.wmde-markdown-var`](https://github.com/uiwjs/react-markdown-preview/blob/a53be1e93fb1c2327649c4a6b084adb80679affa/src/styles/markdown.less#L1-L193) selector.
157+
158+
```jsx
159+
const Demo = () => {
160+
return (
161+
<div>
162+
<div className="wmde-markdown-var"> </div>
163+
<MarkdownPreview source="Hello World!" />
164+
</div>
165+
)
166+
}
154167
```
155168

156169
## Development

0 commit comments

Comments
 (0)