Skip to content

feat: improve footnote support with better styling and documentation#1442

Open
vincent067 wants to merge 1 commit intodoocs:mainfrom
vincent067:feature/footnote-support-2026-04-07
Open

feat: improve footnote support with better styling and documentation#1442
vincent067 wants to merge 1 commit intodoocs:mainfrom
vincent067:feature/footnote-support-2026-04-07

Conversation

@vincent067
Copy link
Copy Markdown

Summary

This PR improves the footnote support in the WeChat Markdown Editor with better styling and comprehensive documentation.

Changes

Technical Improvements

  • Refactored footnotes.ts: Replaced module-level Map with WeakMap for better render context isolation, preventing potential issues with concurrent renderings
  • Improved regex patterns: Enhanced footnote definition matching to support both numeric [^1] and named [^note] references more robustly
  • Better whitespace handling: Added .trim() to footnote content for cleaner output
  • WeChat-compatible styling: Added inline styles optimized for WeChat's rendering engine

Documentation

  • Added footnote feature to the core features list in README
  • Created new "扩展语法" section with detailed footnote usage examples
  • Documented both numeric and named footnote syntax
  • Explained the click-to-jump functionality

Usage Example

微信 Markdown 编辑器[^1] 是一款高度简洁的编辑器[^note][^1]: https://github.com/doocs/md
[^note]: 支持自定义主题样式、内容管理、多图床、AI 助手等特性。

Testing

  • Footnote references render correctly as superscript
  • Footnote definitions compile into a numbered list
  • Click-to-jump links work properly
  • Styling is compatible with WeChat's rendering

Related Issue

Closes #1334


Thanks for maintaining this awesome project!

- Refactor footnotes.ts to use WeakMap for better render context isolation
- Improve regex patterns for more robust footnote parsing
- Add WeChat-compatible inline styles for footnote rendering
- Add comprehensive footnote documentation to README with usage examples

Closes doocs#1334
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

🚀 Surge Preview has been successfully deployed!

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

Built with commit 56d1c76

@yanglbme
Copy link
Copy Markdown
Member

yanglbme commented Apr 7, 2026

项目原本就支持了脚注,你改了之后,好像反而有点问题?

image image

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