mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-04 01:09:20 +02:00
feat(v2): allow import SVG images (#2764)
This commit is contained in:
parent
6db5e8dff8
commit
8e24454154
4 changed files with 416 additions and 4 deletions
|
@ -24,6 +24,14 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
|
|||
/>;
|
||||
```
|
||||
|
||||
You can also import SVG images, which will be transformed into React components.
|
||||
|
||||
```jsx title="MyComponent.js"
|
||||
import DocusaurusLogoWithKeytar from '@site/static/img/docusaurus_keytar.svg';
|
||||
|
||||
<DocusaurusLogoWithKeytar title="test" className="blah" />
|
||||
```
|
||||
|
||||
### Markdown example
|
||||
|
||||
Thanks to MDX, you can also use `useBaseUrl` utility function in Markdown files! You'd have to use `<img>` tags instead of the Markdown image syntax though. The syntax is exactly the same as in JSX.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue