feat(v2): allow import SVG images (#2764)

This commit is contained in:
Alexey Pyltsyn 2020-05-18 06:18:02 +03:00 committed by GitHub
parent 6db5e8dff8
commit 8e24454154
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 416 additions and 4 deletions

View file

@ -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.