| {} |
| import { Image } from 'astro:assets'; |
| import placeholder from '../assets/image/placeholder.png'; |
| 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 HtmlEmbed from '../../components/HtmlEmbed.astro'; |
| import ColorPicker from '../../components/ColorPicker.astro'; |
| import Palettes from '../../components/Palettes.astro'; |
| import audioDemo from '../assets/audio/audio-example.wav'; |
| import Accordion from '../../components/Accordion.astro'; |
|
|
| ## Writing your content |
|
|
| Once you have set up |
|
|
| ### Content |
|
|
| Your `` |
|
|
| <HtmlEmbed /> |
|
|
| ### Article.mdx |
|
|
| The `article.mdx` file is the **main entry point** of your article which contains **2 main parts**. |
|
|
| <Note emoji= variant=>**MDX** is a mix of **Markdown** and **HTML/ /a> and <a href= >Components</’/Note> |
|
|
|
|
| #### **Frontmatter** |
|
|
| Metadata and options for the article. Each of them is described in the table below. |
|
|
| <small className=>**Frontmatter** in app//content//small> |
| ```mdx |
| --- |
| title: |
| subtitle: |
| description: |
| published: |
| tags: |
| - research |
| - template |
| authors: |
| - name: |
| url: |
| affiliations: [1] |
| - name: |
| url: |
| affiliations: [1, 2] |
| - name: |
| url: |
| affiliations: [2] |
| affiliations: |
| - name: |
| url: |
| - name: |
| url: |
| doi: 10.1234/ |
| licence: Diagrams ‑/a> with the source available on <a href=>Hugging Face</“ …” |
| seoThumbImage: "https://example.com/thumb.png" |
| tableOfContentsAutoCollapse: true |
| --- |
| ``` |
|
|
| <Accordion |
| | Field | | | | |
| | --- | --- | --- | --- | |
| | title | | ; supports line breaks with "\n" (falls back to "Untitled article") | string | |
| | subtitle | Yes | Shown just below the title | string | |
| | description | Yes | Used for SEO/meta description | string | |
| | published | Yes | e.g., "2025-02-19" or readable date | string/date | |
| | tags | No | List of keywords | string[] | |
| | authors | No | Affiliation indices refer to the `affiliations` list | `string[] or { name, url?, affiliations? }[]` | |
| | affiliations | No | Alias: `affiliation` (single or array) | `{ name, url? }[]` | |
| | doi | No | DOI identifier | string | |
| | licence | No | Rendered in footer; HTML supported | string (HTML allowed) | |
| | seoThumbImage | No | Overrides default OpenGraph image | string (URL) | |
| | tableOfContentsAutoCollapse | No | Controls TOC auto-collapse | boolean | |
| </Accordion> |
|
|
| #### **Content** |
|
|
| Your story. Write your content here. |
|
|
| <small className="muted">**Content** in app/src/content/article.mdx</small> |
| ```mdx |
| import placeholder from '../assets/image/placeholder.png' |
| import ResponsiveImage from '../components/ResponsiveImage.astro' |
| import Sidenote from '../components/Sidenote.astro' |
|
|
| <Sidenote> |
| This paragraph is written in Markdown. |
| <Fragment slot="aside">A short callout inserted via a component.</Fragment> |
| </Sidenote> |
| <ResponsiveImage src={placeholder} alt="Sample image with optimization" /> |
|
|
| This paragraph is also written in Markdown. |
| ``` |
|
|
| #### Chapters |
|
|
| |
|
|
| Simply **create a new file** in the `app/src/content/chapters` **directory**. |
| Then, **include** your new chapter in the main `article.mdx` like below. |
|
|
|
|
| <small className="muted">Example</small> |
| ```mdx |
| import MyChapter from './chapters/my-chapter.mdx'; |
|
|
| <MyChapter /> |
| ``` |
| <small className="muted">You can see a living example here <a target="_blank" href="https://huggingface.co/spaces/tfrere/research-article-template/blob/main/app/src/content/chapters/best-pratices.mdx">app/src/content/chapters/best-pratices.mdx</a>.</small> |
|
|
| ### **Table of |
| |
| The **Table of –; |
|
|
| <Note variant="info" emoji="💡">You can make the table of `` /a>. Which is `true` by default.</ |
|
|
| ### Theme |
|
|
| All **interactive elements** (buttons, inputs, cards, etc.) are themed with the **primary color** you choose. |
|
|
| You can **update this main color** to match your brand by changing the `--primary-color` variable in the `app/src/styles/_variables.css` file. |
|
|
| Use the **color picker** below to see how the primary color affects the theme. |
|
|
| #### Brand color |
|
|
| <Sidenote> |
| <ColorPicker /> |
| <Fragment slot="aside"> |
| You can use the color picker to select the right color. |
| |
| Here is an example of an <a href="#">interactive element</a>. |
| </Fragment> |
| </Sidenote> |
|
|
|
|
| #### Color palettes |
|
|
| Here is a suggestion of **color palettes** for your **data visualizations** that align with your **brand identity**. These palettes are generated from your `--primary-color`. |
|
|
| <Palettes /> |
| <br/> |
| |
| Color should rarely be the only channel of meaning. |
| Always pair it with text, icons, shape or position. The simulation helps you spot palettes and states that become indistinguishable for people with color‑vision deficiencies. |
|
|
| #### Using the palettes |
|
|
| You can copy them manually from the palette viewer just above, or fetch colors via `window.ColorPalettes.getColors(key, count)` where `key` is one of `'categorical'`, `'sequential'`, `'diverging'`, and `count` is the desired number of colors (defaults to 6). |
|
|
| <Accordion title="Code example"> |
| ```js |
| |
| const cat = window.ColorPalettes.getColors('categorical', 8); |
| const seq = window.ColorPalettes.getColors('sequential', 8); |
| const div = window.ColorPalettes.getColors('diverging', 7); |
|
|
| |
| const primaryHex = window.ColorPalettes.getPrimary(); |
|
|
| |
| document.documentElement.style.setProperty('--primary-color', '#6D4AFF'); |
| window.ColorPalettes.refresh(); |
| ``` |
| </Accordion> |