Skip to content

fix: strip the heading the cover page actually promotes - #22

Merged
leonardosalasd merged 1 commit into
mainfrom
fix/strip-first-heading
Sep 10, 2026
Merged

leonardosalasd merged 1 commit into
mainfrom
fix/strip-first-heading

Conversation

@leonardosalasd

Copy link
Copy Markdown
Owner

extract_title now reads the parsed document, so it correctly ignores a # line inside fenced code and recognizes an underlined H1. strip_first_heading was still scanning raw lines, and the two could disagree.

A file opening with a shell block lost the # install comment out of its code and then printed its real title twice, once on the cover and once as a heading. A file whose title is underlined rather than prefixed kept the heading for the same reason. Both come from deciding what a heading is by looking at a single line, so the scan now tracks fences and treats an = underline as the H1 it is.

`extract_title` now reads the parsed document, so it correctly ignores a `# `
line inside fenced code and recognizes an underlined H1. `strip_first_heading`
was still scanning raw lines, and the two could disagree.

A file opening with a shell block lost the `# install` comment out of its code
and then printed its real title twice, once on the cover and once as a heading.
A file whose title is underlined rather than prefixed kept the heading for the
same reason. Both come from deciding what a heading is by looking at a single
line, so the scan now tracks fences and treats an `=` underline as the H1 it is.
@leonardosalasd
leonardosalasd merged commit 290a2d8 into main Sep 10, 2026
21 checks passed
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