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
Implement a cacheable Gradle task that concatenates an ordered list of
.mdfiles 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: RegularFilePropertyabstract val headingDemotionOffset: Property<Int>— optional per-merge offset applied to all source files (default 0)HeadingDemoterif offset > 0, graft child nodes into a single rootDocument, emit viaMarkdownFormatterAcceptance criteria
.mdfile containing the content of all input files in order