Skip to content

Starlight Initial Setup

Starlight์„ ๋‚ด ์š”๊ตฌ์‚ฌํ•ญ์— ๋งž๊ฒŒ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด ์ ์ ˆํ•œ ์กฐ์ •์ด ํ•„์š”ํ–ˆ๋‹ค.
๋‹ค์Œ์€ Starlight(25๋…„ 4์›” ๊ธฐ์ค€)์—์„œ๋Š” ๊ธฐ๋ณธ ์ œ๊ณตํ•˜์ง€ ์•Š์ง€๋งŒ ๋‚ด๊ฒŒ ํ•„์š”ํ•œ ๊ธฐ๋Šฅ๋“ค์ด๋‹ค.

  1. $๋ฅผ ์ด์šฉํ•œ ์ˆ˜์‹ ์ž‘์„ฑ ๊ธฐ๋Šฅ (์ธ๋ผ์ธ๊ณผ ๋ธ”๋ก ํ˜•ํƒœ๋ฅผ ๋ชจ๋‘ ์ง€์›)
  2. Mermaid ๊ธฐ๋ฐ˜์˜ ๋‹ค์ด์–ด๊ทธ๋žจ ๋ Œ๋”๋ง ๊ธฐ๋Šฅ

์ด์— ๋”ฐ๋ผ ์•„๋ž˜์˜ ๋‹จ๊ณ„๋ฅผ ๊ฑฐ์ณ ์š”๊ตฌ์‚ฌํ•ญ์„ ๋งŒ์กฑ์‹œ์ผฐ๋‹ค.
โ€” ์ดํ•˜์—์„œ ์œ„ ๋‘ ๊ธฐ๋Šฅ์„ ์ˆœ์„œ๋Œ€๋กœ ๊ฐ๊ฐ โ€˜์ˆ˜์‹โ€™, โ€˜๋‹ค์ด์–ด๊ทธ๋žจโ€™์œผ๋กœ ์•ฝ๊ธฐํ•œ๋‹ค.

  1. ํŒจํ‚ค์ง€ ์„ค์น˜

    Terminal window
    npm install remark-math rehype-mathjax
  2. astro.config.mjs ์„ค์ •

    import { defineConfig } from 'astro/config';
    import starlight from '@astrojs/starlight';
    import remarkMath from 'remark-math';
    import rehypeMathJax from 'rehype-mathjax';
    export default defineConfig({
    // ์ดํ•˜์˜ 'markdown' ํ•ญ๋ชฉ์ด ์—†๋‹ค๋ฉด ์ถ”๊ฐ€
    markdown: {
    remarkPlugins: [remarkMath],
    rehypePlugins: [rehypeMathJax],
    },
    integrations: [
    starlight({
    // ...
    // ์ธ๋ผ์ธ ์ˆ˜์‹์„ ์œ„ํ•œ ์„ค์ • (์•„๋ž˜ ๋””๋ ‰ํ† ๋ฆฌ์— CSS ํŒŒ์ผ ์ƒ์„ฑ ํ•„์š”)
    customCss: ['./src/mathjax.css'],
    }),
    ],
    });
  3. ์ถ”๊ฐ€ ์ž‘์„ฑ (์ˆ˜์‹ ๊ธฐ๋Šฅ)

    ์ฝ”๋“œ์—์„œ ์ฃผ์„์œผ๋กœ ์–ธ๊ธ‰ํ–ˆ๋“ฏ์ด, ์ธ๋ผ์ธ ์ˆ˜์‹์„ ์œ„ํ•ด์„œ๋Š” ๋ณ„๋„์˜ CSS ํŒŒ์ผ ์ž‘์„ฑ์ด ํ•„์š”ํ•˜๋‹ค.

    src/mathjax.css
    mjx-container svg {
    display: inline !important;
    }

์ด์ƒ Starlight์—์„œ ์ˆ˜์‹๊ณผ Mermaid ๋‹ค์ด์–ด๊ทธ๋žจ์„ ๋ Œ๋”๋งํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์„ ์†Œ๊ฐœํ–ˆ๋‹ค.
์ฐธ๊ณ ๋กœ, ์ด ๋‘˜์˜ ์„ค์ •์„ ๋ชจ๋‘ ์ ์šฉํ•œ astro.config.mjs์˜ ๋ชจ์Šต์€ ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

astro.config.mjs
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import remarkMath from 'remark-math';
import rehypeMathJax from 'rehype-mathjax';
import remarkMermaid from 'remark-mermaidjs';
export default defineConfig({
markdown: {
remarkPlugins: [remarkMath, remarkMermaid],
rehypePlugins: [rehypeMathJax],
},
integrations: [
starlight({
customCss: ['./src/mathjax.css'],
// ...
}),
],
});

๋์œผ๋กœ ์ˆ˜์‹๊ณผ ๋‹ค์ด์–ด๊ทธ๋žจ ๊ฐ๊ฐ์˜ ์˜ˆ์‹œ ์ž‘์„ฑ๊ณผ ํ•ด๋‹น ๋ Œ๋”๋ง ๋ชจ์Šต์„ ๋ณด์ธ๋‹ค.


A_{m,n} =
\begin{pmatrix}
a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\
a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m,1} & a_{m,2} & \cdots & a_{m,n}
\end{pmatrix}

์ตœ์‹  ์œ ํ˜• โ€˜๋ ˆ์ด๋” ๋‹ค์ด์–ด๊ทธ๋žจโ€™์˜ ๋ฒ ํƒ€ ๋ฒ„์ „์„ ํ‘œ์‹œํ•œ๋‹ค.

MathScienceEnglishHistoryGeographyArtAliceBobGrades

---
title: "Grades"
---
radar-beta
axis m["Math"], s["Science"], e["English"]
axis h["History"], g["Geography"], a["Art"]
curve a["Alice"]{85, 90, 80, 70, 75, 90}
curve b["Bob"]{70, 75, 85, 80, 90, 85}
max 100
min 0