Skip to content

fix(wiki): skip ambiguous single-Han auto-links - #2860

Open
JYao-Chen wants to merge 1 commit into
Tencent:mainfrom
JYao-Chen:fix/wiki-single-han-autolink
Open

fix(wiki): skip ambiguous single-Han auto-links#2860
JYao-Chen wants to merge 1 commit into
Tencent:mainfrom
JYao-Chen:fix/wiki-single-han-autolink

Conversation

@JYao-Chen

Copy link
Copy Markdown
Contributor

Description

Wiki auto-linking currently treats a one-character Han page title as a safe substring match. Chinese prose has no whitespace token boundary, so a page such as can be injected inside 风沙, and inside 栏目, splitting normal words into incorrect links.

This change skips automatic cross-link injection when the surface form is exactly one Han character. It does not remove one-character Wiki pages and it preserves explicit [[slug|label]] links produced by the generator or author.

Regression tests cover both the false-positive substring and explicit-link preservation.

Type of Change

  • 🐛 Bug fix
  • 🧪 Test

Related Issue

N/A

Testing

  • go test ./internal/application/service -run 'TestLinkifyContent|TestFindFirstSafeMatch|TestComputeForbiddenSpans' -count=1
  • go vet ./internal/application/service
  • git diff --check origin/main...HEAD

Checklist

  • git diff --check origin/main...HEAD passes
  • Changed source files are formatted
  • Targeted tests for the changed packages/components pass
  • Diff-scoped lint passes where applicable
  • Full-repository checks were run, or any unrelated/environment-dependent failures are documented above
  • Self-reviewed the code
  • Added/updated tests covering the change
  • Updated related documentation
  • Breaking changes are clearly called out in the description above

Screenshots / Recordings

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant