On top of standard MDX syntax, this template adds a few extensions that make writing post content easier.
- Call up a
<Callout>/<Alert>with:::type[label] - Expand a paragraph containing only a URL into an external link card
- Generate a link or card to an internal post with
[[slug]] - Code highlighting via
astro-expressive-code
This post is a sample for checking each piece of syntax and how it actually looks.
Callout (:::type[label])
Add a label like :::type[title] and it is converted into a <Callout>. This page shows five types: tip / warning / check / info / help / alert.
:::tip[Tip title]Use this to emphasize a key point.:::
:::warning[Warning title]Use this to call attention to something.:::
...A :::tip[...] sample. Use this to emphasize the main point of a post.
A :::warning[...] sample.
A :::check[...] sample.
A :::info[...] sample.
A :::help[...] sample.
A :::alert[...] sample.
Alert (:::type)
Omit the label ([]) and it is converted into an <Alert> with no title area.
:::warningOmit the label and you get an Alert with no title area.:::A :::tip sample (Alert).
A :::warning sample (Alert).
A :::check sample (Alert).
A :::info sample (Alert).
A :::help sample (Alert).
A :::alert sample (Alert).
A case with multiple elements inside
You can use basic Markdown directly inside ::: as well. Let’s check that lists, links, emphasis, and the like line up without breaking.
A sample for checking the elements you can write inside.
- List item 1
- List item 2
- Child item
A link, code, and emphasis all line up naturally.
External link cards (automatic URL expansion)
A paragraph containing only a URL is expanded at build time into a <LinkCard type="external"> by fetching the target site’s OGP. Fetch results are cached as JSON with an MD5 hash under .cache/ogp/, and within the 7-day TTL they are not re-fetched.
https://lism-css.com/en/How it looks:
Overriding
For sites where the fetch fails, or when you want to set the title and description yourself, you can write <LinkCard type="external"> directly in MDX.
<LinkCard type="external" href="https://example.com" title="Custom title" description="Write your own description here." />Internal link cards ([[slug]])
Use Obsidian-style [[slug]] syntax to reference a post within the same blog. The slug is the filename (without extension) under src/posts/{category}/.
Card from a standalone paragraph
Write [[slug]] as a standalone paragraph and it pulls the post’s info from Content Collections and outputs a <LinkCard type="internal">.
[[lism-css-intro]]Inline links
Write [[slug]] in the middle of a paragraph and you get an inline link with the post title as its text.
For details, see [[lism-css-intro]].For details, see An Overview of Lism CSS.
Overriding the display text
Use [[slug|display text]] to override the display text. Even as a standalone paragraph, it is treated as a link when an alias is present (write it without an alias when you want a card).
See [[lism-css-intro|the previous post]].See the previous post.
Code highlighting (astro-expressive-code)
Syntax highlighting for code blocks uses astro-expressive-code. Because astro.config.mjs sets themes: 'github-dark', the same color scheme (GitHub Dark) is applied in both light and dark mode. To switch between multiple themes, pass an array such as themes: ['github-dark', 'github-light'] and use themeCssSelector to sync with your site’s theme toggle.
Beyond plain code blocks, you can also add a filename title, highlight specific lines, show diffs, and more.
```ts title="src/lib/archive.ts" {3}export function getArchiveKey(date: string) { const [year, month] = date.split(/[-./]/); return { year, month };}```export function getArchiveKey(date: string) { const [year, month] = date.split(/[-./]/); return { year, month };}```bash title="Terminal"pnpm installpnpm dev```pnpm installpnpm devWhere the specs live
The remark plugins that implement each piece of syntax are gathered under src/lib/.
| File | Role |
|---|---|
remark-directive.mjs | Converts :::type[label] / :::type into <Callout> / <Alert> |
remark-link-card.mjs | Converts a URL-only paragraph into <LinkCard type="external"> |
remark-wiki-link.mjs | Converts [[slug]] / [[slug|alias]] into <LinkCard type="internal"> / <WikiLink> |
For details, see the template walkthrough in Inside the blog-astro-techlog template.