跳转到主要内容

OINK 迁移边界

从 OINK 0.4 到 OINK 0.6.0 所支持的源码、配置与验证迁移边界。
OINK 0.6.0 契约

这是随 OINK 0.6.0 正式发布的迁移契约。本页是权威中文源文件,与英文版本 一同维护在 content/docs/design/

这是源码与配置指南,不是版本发布流水账。本地源码、提交、标签、推送、消费站点 固定版本、部署与生产一致仍是彼此独立的状态。面向读者的升级流程见 版本升级

工具范围

bin/migrations/oink06.py 只扫描和自动改写站点内容目录下的 Markdown 文件, 包括受支持的 YAML front matter。它不改写 Hugo 配置、数据文件、布局、资源、 模块或生成输出。TOML/JSON front matter 与有歧义的 Markdown 会连同位置一起报告, 留给人工检查。

默认执行 dry-run;完成后的迁移具有幂等性:

python3 bin/migrations/oink06.py report --sites <dir>... --md report.md --json report.json
python3 bin/migrations/oink06.py migrate --site <dir>
python3 bin/migrations/oink06.py migrate --site <dir> --write
python3 bin/migrations/oink06.py check --site <dir>

代码围栏不会改写。book_figures.py 保留范围明确的 TPME、DDIA v1/v2 与 pg-internal profile;它不是通用解析器。

从 0.4 内容迁移到当前形态

已移除形态当前形态工具键
alertdetailspageinfo、原始 disclosure> [!TYPE] 提示块callout
tabpane、旧 tabcode-groupcode-tab相邻 {tab=} 区块,或 tabs / tabtabs
FileTree shortcode 或 {.filetree} 列表filetree 围栏filetree
Gallery shortcode 或 {.gallery} 列表gallery 围栏gallery
ECharts / infographic shortcode同名数据围栏datafence
Docsy 卡片家族.cards 列表或 cards / cardcards
imgprocimageMarkdown 图片加属性image
readfileincludeinclude
围栏 filename=title=fencetitle
badge outline=移除 outlinebadge
叶子 examplebook-figures kind=eg、显式 book-* 索引eg
百分号分隔的 fields尖括号分隔的 fields / fieldfieldsdelim
Docsy _param 占位符与 card header= 高亮Font Awesome / badge / param 或提示块param_placeholders
不支持的旧 shortcode报告源码位置,人工检查reportonly

配置与 front matter

以下配置改动需要手工处理;工具可以报告匹配的 front matter 键,但绝不编辑站点 配置。

旧配置当前配置
offlineSearch*offline_search*
disable_click2copy_chromaui.code_copy,取反
content_width`reading_width: slim
github_urlgithub_repo
ui.no_left_sidebarui.sidebar_enabled,取反
breadcrumb 别名ui.breadcrumb
ui.scrollSpyui.scroll_spy,取反
ui.showLightDarkModeMenuui.dark_mode.show_menu
ui.readingtimeui.reading_time
ui.ul_showui.sidebar_expand_levels
ui.docs_rootui.docs_sidebar_root
ui.pagerui.pager_types
annotation/zoom/keyboard/reading 的 { enable: bool } map裸布尔值
ui.typography.presetui.typography
print.disable_tocprint.toc,取反

Prism、rss_sectionsalgolia_docsearch 已移除。Chroma 是唯一高亮器;Algolia 配置为 search.algolia。页面级覆盖会去掉 ui. 前缀。旧 hide_feedbackhide_readingtimeexclude_searchcontent_width、camelCase 手工链接与嵌套 front matter ui map 会连同替代项一起报告。

从 0.5 到 0.6

  • upstream_linkupstream_nameupstream_copyrightupstream_licenseupstream_notice 替代 upstream_attribution;把 downstream_modified 改名为 upstream_modified
  • 用一个 GitHub release_url 替代 release map;从发布索引移除 release_productsrelease_group_by_product
  • 博客与默认日期现在采用 ISO 2006-01-02;面向读者的日期继续显式保留 time_format_blogtime_format_default

已移除名称会警告,并采用文档规定的安全回退或不渲染;普通预览可以继续,严格 门禁通过 --panicOnWarning 拒绝它们。blog_index_togglefeatured_image: herotoc_styletoc_taxonomies 是增量选择启用项,不会 引入内容类型;沉浸式阅读仍使用普通博客外壳。

前置条件与验证

按照组件契约启用 Goldmark unsafe 渲染、块属性与 独立块图片。要使用 \(...\)\[...\]$$...$$,需要显式启用 passthrough; Hugo 不会合并主题的 markup 配置。

针对改动的契约运行范围最小的源码与输出检查,覆盖两个受支持的 Hugo 版本;运行时 变化时执行 JavaScript 测试,并严格构建根路径与子路径。对于维护范围内的站点, 在桌面与窄视口检查有代表性的 EN/ZH Docs 与 Blog 路由,再分别记录固定版本、部署 与线上一致状态。