Skip to content

SentencePerLineFormatter transformer #13

Description

@roxspring

Implement a transformer that reformats paragraph text so each sentence starts on a new line.

Background

Some documentation style guides (including projects that want clean diffs) require one sentence per line. This transformer enforces that rule.

Scope

  • Visits Paragraph nodes
  • Splits inline content at sentence boundaries (. , ? , ! heuristics — end of sentence followed by whitespace and an uppercase letter or end of content)
  • Inserts a hard line break (Flexmark SoftLineBreak or literal newline in output) between sentences
  • Inline nodes (bold, italic, links, code spans) are treated as atomic units — sentence boundaries are not inserted inside them
  • Fenced code blocks and inline code spans are skipped

Notes

  • This is a best-effort heuristic — abbreviations (e.g. "e.g. ", "i.e. ") may produce false splits; document known limitations
  • Sentence boundary detection algorithm is configurable/replaceable

Acceptance criteria

  • A paragraph with multiple sentences is split, one sentence per line
  • Inline nodes are not broken
  • Code content is not modified
  • A paragraph with a single sentence is unchanged

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions