fix(converters): stop blog footer turning the last body line into a heading#75
Open
abhay-codes07 wants to merge 1 commit into
Open
Conversation
…eading The footer was concatenated onto the body with no blank line, so output ended with 'last body line\n---'. CommonMark parses text immediately followed by '---' as a setext H2, so the final line of every blog post body became a heading and the intended horizontal rule was dropped. Add a blank line between the body and the footer so '---' is a thematic break.
|
@abhay-codes07 is attempting to deploy a commit to the Dodo Payments Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Fixes a CommonMark rendering bug in the blog markdown converter where the footer’s --- could be parsed as a setext heading underline for the final body line, causing the rule to disappear and the last line to render as an H2.
Changes:
- Insert an extra newline between the blog post body and the footer so the footer’s
---is parsed as a thematic break, not a setext underline. - Add a regression test to ensure the output contains
last body line\n\n---(and notlast body line\n---). - Add a changeset for a patch release of
@dualmark/converters.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/converters/src/blog.ts | Adds a separating newline between body and footer to prevent setext heading parsing. |
| packages/converters/test/converters.test.ts | Adds a regression test asserting the body/footer separation behavior. |
| .changeset/blog-converter-setext-heading.md | Records the bug fix as a patch changeset for release notes/versioning. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+55
to
+57
| // Separate the body from the footer with a blank line. `base` ends with the | ||
| // body's last line (no trailing newline) and `footer` starts with "---"; | ||
| // without the blank line CommonMark parses "lastline\n---" as a setext H2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The blog converter joined its footer onto the body with no blank line, so the output ended with
last body line\n---. CommonMark reads that as a setext H2, so the final line of every blog post body was rendered as a heading and the horizontal rule before the footer links vanished. This adds the missing blank line.Closes #74.
Changes
packages/converters/src/blog.ts: separate the body from the footer with a blank line so the trailing---is a thematic break, not a setext underline.---, and is not glued directly to---.Type
AEO_SPEC_VERSION)Verification
bun run buildpassesbun run testpasses (converters: 39 tests)bun run typecheckpassesdualmark verify(no examples touched)/spec/: ran sync-spec (no spec files touched)Changeset
@dualmark/converters)cc @thepushkaraj @aagarwal1012. Small one, but it affects the rendered markdown of every blog post that has a body.