Skip to content

MergeMarkdownTask #16

Description

@roxspring

Implement a cacheable Gradle task that concatenates an ordered list of .md files into a single output document using AST-level merging.

Scope

  • @CacheableTask abstract class MergeMarkdownTask : DefaultTask()
  • @InputFiles abstract val sourceFiles: ListProperty<RegularFile> — ordered list of input files
  • @OutputFile abstract val outputFile: RegularFileProperty
  • abstract val headingDemotionOffset: Property<Int> — optional per-merge offset applied to all source files (default 0)
  • AST-level merge: parse each file, apply HeadingDemoter if offset > 0, graft child nodes into a single root Document, emit via MarkdownFormatter
  • Front matter from the first file only is preserved; subsequent files' front matter is stripped

Acceptance criteria

  • Output is a single .md file containing the content of all input files in order
  • Heading levels are correctly demoted when offset > 0
  • Front matter from the first file is preserved; subsequent front matter is stripped
  • Page separators (configurable, default: blank line) are inserted between merged files

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