Use github-slugger in place of slug - #373
Open
LanHikari22 wants to merge 3 commits into
Open
LanHikari22 wants to merge 3 commits into
LanHikari22 wants to merge 3 commits into
Conversation
When adding a new changelog fragment, uv [1] is required to be installed, but this is not mentioned in the document. [1]: https://github.com/astral-sh/uv
Author
|
I learned that in the cargo-toml-vs-cargo-lock docs that in general Cargo.lock should be tracked, so I am reverting adding it to .gitignore here. |
ONEGAYI
added a commit
to ONEGAYI/obsidian-export-desktop
that referenced
this pull request
Aug 24, 2026
format_anchor 弃用手写 slug 实现,改委托 github-slugger crate(与上游 PR zoni#373 同款路线),修复四处与 GitHub/VS Code 预览行为的偏差: - 全角标点(:,)此前原样保留进锚点,链接在 GitHub/VS Code 上断裂; 现无痕剔除([[note#总纲:三份形态,两个断口]] → #总纲三份形态两个断口) - 标点剔除不再误产连字符(1.1.1 C → zoni#111-c 而非 #1-1-1-c, 即上游 zoni#370 的 Number Headings 场景) - 连续连字符不再折叠(this--or-that 保持原样) - 首尾连字符不再修剪(-dashed- 保持原样) 行为向量取自 2026-08 对 GitHub 网页渲染的实测(secret gist 抓取 SSR anchor href,与 VS Code 官方包源码、github-slugger 本地计算三方 一致);封装层对 section 先 trim,对齐 VS Code 预览的首尾空白处理。 链接显示文本不受影响,仅 #anchor 部分变化。 契约测试:lib 内 test_format_anchor_matches_github_slugger 锁定全部 实测向量;chinese-anchor fixture 扩展全角标点标题的端到端断言。 已知限制:GitHub 对同文档重复标题的 -1/-2 去重后缀需要文档级状态, 本实现无状态、不做去重。 Close zoni#370(上游)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As explained in #370, if there are periods used in the heading and it is referenced, then obsidian-export generates invalid links.
Added gfm-heading-ids-compliance test to reproduce the issue in #370.
Cargo.lock is also added to .gitignore as it is autogenerated.
Closes #370.
This passes all pre-commit hook checks.
Please let me know if there is a use-case for using slug that I may be missing. Replacing it with github-slugger passes all tests, as is.
You can find my notes for this here.