Skip to content

Commit 5275a30

Browse files
committed
Enable zooming of images in markdown content
Use `docusaurus-plugin-image-zoom` to enable zooming of images in markdown content. Signed-off-by: Sergey Fedorov <[email protected]>
1 parent 16b74eb commit 5275a30

File tree

3 files changed

+77
-1
lines changed

3 files changed

+77
-1
lines changed

docusaurus.config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ const config = {
7979
remarkPlugins: [remarkMath],
8080
rehypePlugins: [rehypeKatex],
8181
},
82-
]
82+
],
83+
'image-zoom',
8384
],
8485

8586
presets: [
@@ -231,6 +232,14 @@ const config = {
231232
darkTheme: darkCodeTheme,
232233
additionalLanguages: ['bash'],
233234
},
235+
zoom: {
236+
selector: '.markdown img',
237+
background: {
238+
// Using `--ifm-color-white` in light theme because `--ifm-background-color` makes background transparent
239+
light: 'var(--ifm-color-white)',
240+
dark: 'var(--ifm-background-color)',
241+
}
242+
}
234243
}),
235244
};
236245

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"@mdx-js/react": "^3.0.1",
2222
"botex": "^1.0.0",
2323
"clsx": "^2.1.1",
24+
"docusaurus-plugin-image-zoom": "^3.0.1",
2425
"prism-react-renderer": "^2.3.1",
2526
"react": "^18.3.1",
2627
"react-dom": "^18.3.1",

0 commit comments

Comments
 (0)