Duoism 基于 Vlad Esafev 的 Twoism 扩展而来,面向个人写作、技术随笔与研究笔记。点击右上角的 ☀ / ☾ 与 中 / EN,你可以即时体验整站的主题与语言切换。
双语写作与自动配对
Duoism 支持两种双语文章组织方式:
- 文件名后缀自动配对:例如本文由
introducing-duoism.mdx与introducing-duoism.en.mdx组成,系统会自动聚合为同一篇笔记,并在切换语言时无缝同步标题、正文与侧边目录。 - 显式指定关系:在译文 frontmatter 中填写
translationOf: <主文章 slug>和lang: zh | en。
单语文章同样可以正常发布,无需额外配置。
构建期自动 Atkinson 抖动图像
你只需要像平常一样在 Markdown 或 MDX 中插入相对路径图片,Duoism 会在开发与构建阶段自动调用 sharp 生成浅色与深色两套 Atkinson 抖动 WebP 图像,并输出响应式 <picture> 标签:

缓存结果默认写入被
.gitignore忽略的public/_dithered/目录,并在astro:build:done阶段自动同步到构建产物。
数学排版与代码块
内置 remark-math 与 rehype-mathjax,支持行内公式
代码块使用与主题色协调的 CSS Variables Shiki 配色:
export function greet(lang: 'zh' | 'en') {
return lang === 'zh' ? '你好,Duoism。' : 'Hello, Duoism.';
}
交互式 SVG 研究图表
在 .mdx 笔记中可以直接引入零第三方图表库依赖的 ResearchPlot 组件,支持鼠标悬停、点击锁定与键盘左右方向键浏览:
示例:样本量与验证集得分
自定义你的站点
- 修改
src/consts.ts中的站点名称、描述、链接与头像设置 - 编辑
src/content/intro.mdx与src/content/intro.en.mdx自定义首页简介 - 在
src/data/links.json中维护你的友链,远程与本地头像都会自动抖动化
Duoism is an Astro theme derived from Vlad Esafev’s Twoism, tailored for personal writing, technical essays, and research notes. Click ☀ / ☾ and 中 / EN in the top-right corner to toggle the palette and language instantly.
Bilingual Notes & Automatic Pairing
Duoism supports two ways to publish bilingual notes:
- Filename suffix pairing: This post consists of
introducing-duoism.mdxandintroducing-duoism.en.mdx. They merge into a single URL, syncing title, body, and table of contents whenever you switch languages. - Explicit frontmatter linking: Set
translationOf: <base-slug>andlang: zh | enin a companion file.
Monolingual notes work out of the box with no extra configuration.
Automatic Build-Time Atkinson Dithering
Drop any local image next to your Markdown or MDX note and reference it via a relative path. Duoism automatically generates lossless light and dark Atkinson-dithered WebP variants with sharp and emits a theme-aware <picture> element:

Generated assets are cached in
public/_dithered/(git-ignored) and synced automatically into the final build output via an Astro integration hook.
Math Typesetting & Code Blocks
Powered by remark-math and rehype-mathjax, both inline math like
Code blocks inherit theme-matched CSS variable tokens from Shiki:
export function greet(lang: 'zh' | 'en') {
return lang === 'zh' ? '你好,Duoism。' : 'Hello, Duoism.';
}
Interactive SVG Research Charts
MDX posts can embed the zero-dependency ResearchPlot component, featuring hover inspection, click pinning, and arrow-key navigation:
Example: Validation Score vs. Sample Size
Customize Your Site
- Edit site metadata, portrait, and footer links in
src/consts.ts - Update the homepage bio in
src/content/intro.mdxandsrc/content/intro.en.mdx - Maintain friend links in
src/data/links.json— both remote and local avatars are dithered automatically