Skip to content

Prevent title and subtitle duplication in published post bodies #537

Closed
3 of 3 issues completed
Closed

Description

@edithatogo

Problem

When a Markdown source contains title and subtitle front matter and repeats those values at the start of the Markdown body, the resulting Substack draft can show the title/subtitle both in Substack's header fields and in the article body.

Initial evidence

  • Front matter is correctly removed by parseFrontmatter().
  • preparePost() removes only a leading Markdown heading that exactly matches the resolved title.
  • It does not remove a matching leading subtitle paragraph/heading.
  • Checked-in examples/basic.md currently repeats the front-matter title as a body H1.
  • Documentation does not state the canonical no-duplication source shape.
  • Agent integration packages provide MCP launch metadata but no authoring guardrail for this ambiguity.

Reproduction

---
title: "Example title"
subtitle: "Example subtitle"
---

# Example title

Example subtitle

Actual body.

Expected prepared body: Actual body.

Actual prepared body: subtitle remains in the generated ProseMirror body. Title removal is limited to an exact leading heading match and is not documented.

Acceptance criteria

  • Normalize an exact leading title plus exact leading subtitle out of the prepared body without removing legitimate non-matching content.
  • Cover title-only, title+subtitle, formatting, mismatch, and no-front-matter cases with regression tests.
  • Document one canonical source format for users and agents.
  • Correct misleading checked-in examples.
  • Preserve title fallback from a leading heading when front matter has no title.

Activity

  1. edithatogo commented on Aug 10, 2026

    @edithatogo
    OwnerAuthor

    Resolved by T18-01. Exact leading title/subtitle metadata repetitions are normalized at the shared preparation boundary; mismatches and fallback behavior are preserved. Local verification: 14 focused tests, 933 total tests, typecheck and contract checks passed.

  2. added 2 commits that reference this issue on Aug 10, 2026
    59e5dfc
    cdbb8e9
  3. edithatogo commented on Aug 10, 2026

    @edithatogo
    OwnerAuthor

    T18-01 closeout receipt:

    • Root issue: Prevent title and subtitle duplication in published post bodies #537 (confirmed defect, resolved)
    • Main fix PR: Fix title and subtitle body duplication #542, merge 59e5dfc3ca76b53250fba450b247f70dc6af0003
    • Codecov follow-up PR: Close T18-01 patch coverage gap #543, merge cdbb8e9a75c70495c687d0790aa694fb2da29127
    • Behavior: exact leading explicit title headings/paragraphs and subtitle headings/paragraphs are removed from prepared Markdown, HTML, and ProseMirror content; mismatches, later matches, and heading fallback are preserved
    • Local verification: 14 focused tests; 117 files/933 tests; typecheck, Biome, contracts, and programme drift passed
    • Hosted verification: required PR checks passed; Codecov confirmed all modified coverable lines covered; post-merge Security, Hardening, compatibility, Pages, release, programme drift (where applicable), and CI mutation passed
    • Comments: Cursor/Copilot quota notices were non-actionable; the actionable Codecov comment on Fix title and subtitle body duplication #542 was resolved by Close T18-01 patch coverage gap #543
    • Cleanup: both T18-01 branches and the disposable worktree were removed; local master is at remote merge SHA cdbb8e9a75c70495c687d0790aa694fb2da29127
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions