Skip to content

fix: require a space after ATX hashes; parse --- after headings and indented code - #120

Open
Ultroncn wants to merge 2 commits into
developit:mainfrom
Ultroncn:fix/heading-space-and-hr-after-blocks
Open

Ultroncn wants to merge 2 commits into
developit:mainfrom
Ultroncn:fix/heading-space-and-hr-after-blocks

Conversation

@Ultroncn

Copy link
Copy Markdown

Fixes #64, #103 and #112.

#64 — #sth is not a heading. ATX headings now require a space or tab after the # run, as in CommonMark, so hashtags and similar text stay literal. A hash run followed by a newline no longer swallows the next line as heading text either (# + newline + foo used to render as <h1>foo</h1>).

#103, #112 — --- after a heading or an indented code block. Both block types swallow the blank line that follows them, which left the rule without the blank line the HR pattern requires, so it rendered as literal --- text (see the sample document in #112, where the rule after ### Horizontal Rule (divider) came out as <p>---</p>). The HR pattern now also matches a rule at the start of a line when the preceding newlines were already consumed. Setext headings (foo + --- → <h2>) are unaffected, and a rule at the very start or end of a document now parses too.

Verified against the full sample document from #112: before, 1 <hr /> and one literal ---; after, 2 <hr /> with no other output change. Tests: npm test passes (36 passing, was 33), including 3 new tests.

…ndented code

- developit#64: '#sth' no longer parses as a heading. ATX headings now
  require a space or tab after the hashes, as in CommonMark, so
  hashtags and similar text stay literal. A hash run followed by a
  newline no longer swallows the next line as heading text either.
- developit#103, developit#112: a '---' thematic break after an ATX heading or an
  indented code block now parses as <hr />. Both block types swallow
  the blank line that follows them, which used to leave the rule
  without the blank line the HR pattern requires; the HR pattern now
  also matches a rule at the start of a line when the preceding
  newlines were already consumed. Setext headings ('foo' + '---')
  are unaffected, and a rule at the start or end of a document now
  parses too.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T15:34:40.039298Z 4e9312a New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d82dca4721

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/index.js Resolved
Comment thread src/index.js Resolved
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.

HR not working after PRE #sth parses as h1 but should be parsed as #sth and # sth should be parsed as h1

1 participant