Skip to content

fix(core): preserve links starting with [TOC] - #2028

Merged
yanglbme merged 1 commit into
doocs:mainfrom
yuxino:fix/standalone-toc-marker
Nov 21, 2026
Merged

yanglbme merged 1 commit into
doocs:mainfrom
yuxino:fix/standalone-toc-marker

Conversation

@yuxino

@yuxino yuxino commented Nov 21, 2026

Copy link
Copy Markdown
Member

Summary

Starting a paragraph with [TOC](#contents) turned the link label into a table of contents and left (#contents) as plain text. The same thing happened to a paragraph starting with [TOC] guide.

The tokenizer now checks that [TOC] occupies its own line, as the editor examples describe.

markdown-toc-link.mp4

Type of Change

  • Bug fix

Test Procedure

  • Previewed [TOC](#contents) above a heading and checked that the link kept its label and destination.
  • Checked that a standalone [TOC] still generates a table of contents, including with trailing whitespace.

Pre-flight Checklist

  • Reviewed the diff and added regression coverage.
  • Workspace tests, lint, type checks, and the web build passed.

@github-actions

Copy link
Copy Markdown

🚀 Surge Preview has been successfully deployed!

Preview URL: https://doocs-md-preview-pr-2028.surge.sh

Built with commit 7c53c0d

@yanglbme
yanglbme merged commit 0b58377 into doocs:main Nov 21, 2026
5 checks passed
@yuxino
yuxino deleted the fix/standalone-toc-marker branch November 21, 2026 10:15
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.

2 participants