Fix broken Markdown link references to headings#179
Conversation
|
@copilot try again. |
Fixed in 27e3894. The Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
jmalloc
left a comment
There was a problem hiding this comment.
Implementation should have the same semantics as https://github.com/Flet/github-slugger/blob/3461c4350868329c8530904d170358bca1d31448/regex.js
Done in 2eef036. Added |
Agent-Logs-Url: https://github.com/dogmatiq/ferrite/sessions/21656b44-0f6e-4dbb-a02d-e31b7389c545 Co-authored-by: jmalloc <761536+jmalloc@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dogmatiq/ferrite/sessions/1a3a96e1-9aa1-425d-9e11-afb488d35cac Co-authored-by: jmalloc <761536+jmalloc@users.noreply.github.com>
2eef036 to
2ee482f
Compare
Fixes Markdown link references to headings by slugifying the anchor URLs to match GitHub's heading anchor generation algorithm, using the same semantics as github-slugger.
Changes Made
internal/mode/usage/markdown/slug.go(new file): ImplementsheadingSlug()matching the github-slugger algorithm — lowercases the input, keeps Unicode letters, digits, underscores, and hyphens, converts spaces to-, and strips everything else (including backtick characters).internal/mode/usage/markdown/link.go: UpdatedlinkToSpecto applyheadingSlug()to the full heading text (e.g.`VARIABLE_NAME`), correctly stripping backtick formatting and producing slugified anchors like#read_dsninstead of#READ_DSN.internal/mode/usage/markdown/slug_test.go(new file): Unit tests forheadingSlugcovering variable names with backticks, space→hyphen conversion, hyphen preservation, punctuation stripping, Unicode letters, and digits..mdtest data files to reflect the corrected lowercase anchor URLs.Testing
headingSlugbehaviour against the github-slugger algorithm.