Skip to content

HeadingDemoter transformer #11

Description

@roxspring

Implement a transformer that increments all heading levels by a configurable offset.

Scope

  • HeadingDemoter(offset: Int = 1) — increments every Heading node's level by offset
  • H6 + any positive offset: clamp to H6 and emit a warning (H7+ is not valid Markdown)
  • Negative offset (promotion) is also supported

Use case

When merging multiple documents into one, each source file's headings need to be relativised so they sit correctly under a top-level section heading.

Acceptance criteria

  • All headings in a document are incremented by the specified offset
  • H6 with offset > 0 is clamped to H6 with a warning logged
  • offset = 0 produces no change

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