Skip to content

Commit 89aee9b

Browse files
committed
feat: Provide optional prop to do lazy highlighting rendering until the code block is within viewport
1 parent 5581de0 commit 89aee9b

10 files changed

+1875
-934
lines changed

README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,16 @@ To ensure the code block styles automatically adjust to your theme mode (light o
3636
```css
3737
/* file: style.css */
3838
@media (prefers-color-scheme: dark) {
39-
.shiki,
40-
.shiki span {
41-
color: var(--shiki-dark) !important;
42-
background-color: var(--shiki-dark-bg) !important;
43-
/* Optional, if you also want font styles */
44-
font-style: var(--shiki-dark-font-style) !important;
45-
font-weight: var(--shiki-dark-font-weight) !important;
46-
text-decoration: var(--shiki-dark-text-decoration) !important;
47-
}
39+
.shiki,
40+
.shiki span {
41+
color: var(--shiki-dark) !important;
42+
background-color: var(--shiki-dark-bg) !important;
43+
/* Optional, if you also want font styles */
44+
font-style: var(--shiki-dark-font-style) !important;
45+
font-weight: var(--shiki-dark-font-weight) !important;
46+
text-decoration: var(--shiki-dark-text-decoration) !important;
47+
}
48+
}
4849
```
4950

5051
Class-based Dark Mode
@@ -78,13 +79,14 @@ import "./style.css";
7879

7980
## API
8081

81-
| Property | Description | Type | Default |
82-
| --------------- | -------------------------------------------------------- | --------- | -------------------------------------------- |
83-
| block | Receives render code content from `NotionRenderer` | CodeBlock | - |
84-
| className | Additional class for Code | string | - |
85-
| defaultLanguage | Default programming language if not specified in `block` | string | typescript |
86-
| themes | Themes for rendering code | object | {light: "catppuccin-latte", dark: "dracula"} |
87-
| showCopy | Whether to show the copy button | boolean | true |
82+
| Property | Description | Type | Default |
83+
| --------------- | -------------------------------------------------------------------------- | --------- | -------------------------------------------- |
84+
| block | Receives render code content from `NotionRenderer` | CodeBlock | - |
85+
| className | Additional class for Code | string | - |
86+
| defaultLanguage | Default programming language if not specified in `block` | string | typescript |
87+
| themes | Themes for rendering code | object | {light: "catppuccin-latte", dark: "dracula"} |
88+
| showCopy | Whether to show the copy button | boolean | true |
89+
| lazyLoading | Whether to run highlighting rendering when a code block is within viewport | boolean | true |
8890

8991
## Run the Example
9092

0 commit comments

Comments
 (0)