首页Index

认识 Duoism:双语、双色调与自动抖动图像Introducing Duoism: Bilingual, Dual-Tone, Auto-Dithered

2026年11月23日November 23, 2026

Duoism 基于 Vlad Esafev 的 Twoism 扩展而来,面向个人写作、技术随笔与研究笔记。点击右上角的 ☀ / ☾ 与 中 / EN,你可以即时体验整站的主题与语言切换。

双语写作与自动配对

Duoism 支持两种双语文章组织方式:

  1. 文件名后缀自动配对:例如本文由 introducing-duoism.mdx 与 introducing-duoism.en.mdx 组成,系统会自动聚合为同一篇笔记,并在切换语言时无缝同步标题、正文与侧边目录。
  2. 显式指定关系:在译文 frontmatter 中填写 translationOf: <主文章 slug> 和 lang: zh | en。

单语文章同样可以正常发布,无需额外配置。

构建期自动 Atkinson 抖动图像

你只需要像平常一样在 Markdown 或 MDX 中插入相对路径图片,Duoism 会在开发与构建阶段自动调用 sharp 生成浅色与深色两套 Atkinson 抖动 WebP 图像,并输出响应式 <picture> 标签:

构建期自动生成的 Atkinson 抖动波形示例

缓存结果默认写入被 .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 组件,支持鼠标悬停、点击锁定与键盘左右方向键浏览:

示例:样本量与验证集得分
基线模型改进方案
按训练样本量(千)展示F1 分数。序列:基线模型、改进方案。使用左右方向键浏览数值。60708090100124816训练样本量(千)F1 分数1k · 基线模型: 66.22k · 基线模型: 72.84k · 基线模型: 78.48k · 基线模型: 82.116k · 基线模型: 84.01k · 改进方案: 71.52k · 改进方案: 79.14k · 改进方案: 85.68k · 改进方案: 90.416k · 改进方案: 93.2+9.2

自定义你的站点

  • 修改 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:

  1. Filename suffix pairing: This post consists of introducing-duoism.mdx and introducing-duoism.en.mdx. They merge into a single URL, syncing title, body, and table of contents whenever you switch languages.
  2. Explicit frontmatter linking: Set translationOf: <base-slug> and lang: zh | en in 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:

Example Atkinson-dithered wave study generated at build time

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 and display equations render cleanly at build time:

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
BaselineProposed
F1 Score by Training Samples (k). Series: Baseline, Proposed. Use the left and right arrow keys to browse values.60708090100124816Training Samples (k)F1 Score1k · Baseline: 66.22k · Baseline: 72.84k · Baseline: 78.48k · Baseline: 82.116k · Baseline: 84.01k · Proposed: 71.52k · Proposed: 79.14k · Proposed: 85.68k · Proposed: 90.416k · Proposed: 93.2+9.2

Customize Your Site

  • Edit site metadata, portrait, and footer links in src/consts.ts
  • Update the homepage bio in src/content/intro.mdx and src/content/intro.en.mdx
  • Maintain friend links in src/data/links.json — both remote and local avatars are dithered automatically