import { Image } from 'astro:assets';
import placeholder from '../assets/image/placeholder.png';
import audioDemo from '../assets/audio/audio-example.wav';
import HtmlEmbed from '../../components/HtmlEmbed.astro';
import Sidenote from '../../components/Sidenote.astro';
import Wide from '../../components/Wide.astro';
import Note from '../../components/Note.astro';
import FullWidth from '../../components/FullWidth.astro';
import Accordion from '../../components/Accordion.astro';
import ResponsiveImage from '../../components/ResponsiveImage.astro';
## Components
**All** the following **components** are available in the **article.mdx** file. You can also create your own **components** by creating a new file in the `/components` folder.
You have to import them in the **.mdx** file you want to use them in.
### ResponsiveImage
**Responsive images** automatically generate an optimized `srcset` and `sizes` so the browser downloads the most appropriate file for the current viewport and DPR. You can also request multiple output formats (e.g., **AVIF**, **WebP**, fallback **PNG/JPEG**) and control **lazy loading/decoding** for better **performance**.
| Prop | Required | Description
|------------------------|----------|-------------------------------------------------------
| `zoomable` | No | Adds a zoomable lightbox (Medium-like).
| `downloadable` | No | Adds a download button to fetch the image file.
| `loading="lazy"` | No | Lazy loads the image.
| `caption` | No | Adds a caption and credit.
| `id` | No | Adds an `id` to the outer figure for deep-linking and cross-references.
From the RCA Indian Head Test Pattern'}
/>
```mdx
import ResponsiveImage from '../components/ResponsiveImage.astro'
import myImage from './assets/image/placeholder.jpg'
Credit: Photo by Author'}
/>
```
### Placement
Use these helpers when you need to step outside the main content flow: **Sidenotes** for contextual side notes, **Wide** to extend beyond the main column, and **Full-width** for full-width, immersive sections.
#### Sidenotes
This paragraph presents a **key idea** concisely.
**Side note** for brief context or a definition.
```mdx
import Sidenote from '../components/Sidenote.astro'
Main paragraph with the core idea.
Short side note.
```
#### Wide example
demo wide
```mdx
import Wide from '../components/Wide.astro'
Your content here...
```
#### Full-width example
demo full-width
```mdx
import FullWidth from '../components/FullWidth.astro'
Your content here...
```
### Accordion
Can be used like this `some content`. You can pass any children content.
Text, lists, images, code blocks, etc.
| Prop | Required | Description
|-------------|----------|----------------------------------------------------------------------------------
| `src` | Yes | Path to the embed file in the `embeds` folder.
| `title` | No | Short title displayed above the card.
| `desc` | No | Short description displayed below the card. Supports inline HTML (e.g., links).
| `frameless` | No | Removes the card background and border for seamless embeds.
| `align` | No | Aligns the title/description text. One of `left` (default), `center`, `right`.
| `id` | No | Adds an `id` to the outer figure for deep-linking and cross-references.
````mdx
import Accordion from '../components/Accordion.astro'
Free content with markdown and MDX components.
| Prop | Required | Description
|-------------|----------|----------------------------------------------------------------------------------
| `src` | Yes | Path to the embed file in the `embeds` folder.
| `title` | No | Short title displayed above the card.
| `desc` | No | Short description displayed below the card. Supports inline HTML (e.g., links).
| `frameless` | No | Removes the card background and border for seamless embeds.
| `align` | No | Aligns the title/description text. One of `left` (default), `center`, `right`.
| `id` | No | Adds an `id` to the outer figure for deep-linking and cross-references.
```ts
function greet(name: string) {
console.log(`Hello, ${name}`);
}
greet("Astro");
```
````
### Note
Small contextual callout for tips, caveats, or emphasis.
Use notes to surface context without breaking reading flow.
Operation completed successfully.
Be careful: this action cannot be undone.
Plain note without header. Useful for short clarifications.
| Prop | Required | Type | Description |
|----------|----------|------------------------------|-------------------------------------|
| `title` | No | string | Short title displayed in header |
| `emoji` | No | string | Emoji displayed before the title |
| `class` | No | string | Extra classes for custom styling |
| `variant`| No | 'info' | 'success' | 'danger' | Visual intent of the note |
```mdx
import Note from '../../components/Note.astro'
Use notes to surface context without breaking reading flow.
Operation completed successfully.
Be careful: this action cannot be undone.
Plain note without header. Useful for short clarifications.
```
### HtmlEmbed
The main purpose of the ```HtmlEmbed``` component is to **embed** a **Plotly** or **D3.js** chart in your article. **Libraries** are already imported in the template.
They exist in the `app/src/content/embeds` folder.
For researchers who want to stay in **Python** while targeting **D3**, the [d3blocks](https://github.com/d3blocks/d3blocks) library lets you create interactive D3 charts with only a few lines of code. In **2025**, **D3** often provides more flexibility and a more web‑native rendering than **Plotly** for custom visualizations.
| Prop | Required | Description
|-------------|----------|----------------------------------------------------------------------------------
| `src` | Yes | Path to the embed file in the `embeds` folder.
| `title` | No | Short title displayed above the card.
| `desc` | No | Short description displayed below the card. Supports inline HTML (e.g., links).
| `frameless` | No | Removes the card background and border for seamless embeds.
| `align` | No | Aligns the title/description text. One of `left` (default), `center`, `right`.
| `id` | No | Adds an `id` to the outer figure for deep-linking and cross-references.
You can refer to a chart by giving it a name and pointing to it with a link.
-> `like his`
-> ``
Live example: Fig 1
```mdx
import HtmlEmbed from '../components/HtmlEmbed.astro'
```
#### Data
If you need to link your **HTML embeds** to **data files**, there is an **`assets/data`** folder for this.
As long as your files are there, they will be served from the **`public/data`** folder.
You can fetch them with this address: **`[domain]/data/your-data.ext`**
Be careful, unlike images, data files are not optimized by Astro. You need to optimize them manually.
#### Vibe coding charts
If you are from the research field, it can be difficult to use **D3.js** charts instead of **Plotly**.
Happily, **LLM's** are here to help you! In the `app/src/content/embeds` folder, there is a `vibe-code-d3-embeds-directives.md` file that you can use to vibe code **D3.js** charts.
Inside this file, you will find every directives you need to code your own **HtmlEmbed** proof **D3.js** chart.
#### Real world examples
Here are some examples that were vibe coded to inspire you.
---
---
from the ultrascale playbook`}/>
---
---
---
---
---
### Iframes
You can embed external content in your article using **iframes**. For example, **TrackIO**, **Gradio** or even **Github code embeds** can be used this way.
Github code embed
TrackIO embed
Gradio embed
```mdx
```