Skip to content

Commit a1f4a76

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 7ecc5c3 commit a1f4a76

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
@@ -69,7 +69,8 @@ const config = {
6969
remarkPlugins: [remarkMath],
7070
rehypePlugins: [rehypeKatex],
7171
},
72-
]
72+
],
73+
'image-zoom',
7374
],
7475

7576
presets: [
@@ -221,6 +222,14 @@ const config = {
221222
darkTheme: darkCodeTheme,
222223
additionalLanguages: ['bash'],
223224
},
225+
zoom: {
226+
selector: '.markdown img',
227+
background: {
228+
// Using `--ifm-color-white` in light theme because `--ifm-background-color` makes background transparent
229+
light: 'var(--ifm-color-white)',
230+
dark: 'var(--ifm-background-color)',
231+
}
232+
}
224233
}),
225234
};
226235

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
@@ -20,6 +20,7 @@
2020
"@mdx-js/react": "^3.0.1",
2121
"botex": "^1.0.0",
2222
"clsx": "^2.1.1",
23+
"docusaurus-plugin-image-zoom": "^3.0.1",
2324
"prism-react-renderer": "^2.3.1",
2425
"react": "^18.3.1",
2526
"react-dom": "^18.3.1",

0 commit comments

Comments
 (0)