Skip to content

Commit

Permalink
added support for themed images
Browse files Browse the repository at this point in the history
  • Loading branch information
radumojic committed Jan 16, 2025
1 parent 7538a57 commit c4282fc
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 6 deletions.
37 changes: 31 additions & 6 deletions docs/utils.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ title: Markdown Examples

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import useBaseUrl from "@docusaurus/useBaseUrl";
import ThemedImage from "@theme/ThemedImage";

## Base Syntax

Expand Down Expand Up @@ -265,6 +267,29 @@ $$
|x| = \begin{Bmatrix} x & {if } x \geq 0 \\ -x & {if } x < 0 \end{Bmatrix}
$$

### Themed Images

## First Version

![Docusaurus themed image](/img/logo.svg#gh-light-mode-only)![Docusaurus themed image](/img/logo_dark.svg#gh-dark-mode-only)

## Second Version

Must Include

```jsx
import useBaseUrl from "@docusaurus/useBaseUrl";
import ThemedImage from "@theme/ThemedImage";
```

<ThemedImage
alt="Docusaurus themed image"
sources={{
light: useBaseUrl("/img/logo.svg"),
dark: useBaseUrl("/img/logo_dark.svg"),
}}
/>

### YouTube Embed

## First Version
Expand All @@ -274,12 +299,12 @@ $$
## Second version

<iframe
width="560"
height="315"
src="https://www.youtube-nocookie.com/embed/tv6OBimIX98?playlist=tv6OBimIX98"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
width="560"
height="315"
src="https://www.youtube-nocookie.com/embed/tv6OBimIX98?playlist=tv6OBimIX98"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
></iframe>

## Mermaid diagrams
Expand Down
9 changes: 9 additions & 0 deletions src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -621,3 +621,12 @@ table > tfoot:not(:last-child) {
}

/* -------------------- End Mermaid ------------------- */

/* ------------------- Start Dynamic Theme Support ------------------- */

[data-theme="light"] img[src$="#gh-dark-mode-only"],
[data-theme="dark"] img[src$="#gh-light-mode-only"] {
display: none;
}

/* -------------------- End Dynamic Theme Support ------------------- */

0 comments on commit c4282fc

Please sign in to comment.