Skip to content

fix(markdown): recognize headings after a UTF-8 BOM - #718

Open
DivyamTalwar wants to merge 1 commit into
VectifyAI:mainfrom
DivyamTalwar:fix/markdown-utf8-bom
Open

DivyamTalwar wants to merge 1 commit into
VectifyAI:mainfrom
DivyamTalwar:fix/markdown-utf8-bom

Conversation

@DivyamTalwar

Copy link
Copy Markdown

Summary

Markdown saved with a UTF-8 byte-order mark had its first ATX heading ignored. Indexing a document whose introduction followed that heading could silently drop the introduction and promote the first subheading to a root.

Read Markdown using Python's utf-8-sig decoder. It accepts regular UTF-8 and removes an optional initial byte-order mark, so heading text, nesting and line numbers match the regular UTF-8 result.

Validation

  • The new regression test reads the same Markdown file with and without a BOM. The two trees differ on main and are identical with this fix.
  • All 4 tests in tests/test_page_index_md.py passed.
  • git diff --check passes.

This branch has not been deployed

No deployments
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