Add asides with remark directives npm package
- note
- tip
- caution
- danger
- success
:::note[Title]
text
:::
uses :root[data-theme="dark"]
by default, but this can be changed on line 21 of styles.css
Must add remark-directive plugin to your remark plugins before astro-starlight-remark-asides
.
- the
.js
file here is a remark plugin, import it and add it to your remark plugins
import { defineConfig } from "astro/config";
import remarkDirective from "remark-directive";
import astroStarlightRemarkAsides from "./src/path/to/index.js";
// https://astro.build/config
export default defineConfig({
markdown: {
remarkPlugins: [remarkDirective, astroStarlightRemarkAsides],
},
});
- Import the .css file into whatever path is rendering the md/mdx
// src/[slug].astro
---
import "src/path/to/styles.css";
---
<!-- -->
- import the remark plugin and add to remark plugins
import { defineConfig } from "astro/config";
import remarkDirective from "remark-directive";
import astroStarlightRemarkAsides from "astro-starlight-remark-asides";
// https://astro.build/config
export default defineConfig({
markdown: {
remarkPlugins: [remarkDirective, astroStarlightRemarkAsides],
},
});
- Import the .css file into whatever path is rendering the md/mdx
// src/[slug].astro
---
import "astro-starlight-remark-asides/styles.css";
---
<!-- -->