Skip to content

fxxr/md-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

md-compose

npm version License: MIT GitHub stars

md-compose is a lightweight Node.js utility to include Markdown files inside other Markdown files using a simple [[[path/to/file.md]]] syntax.
Perfect for building modular documentation, reusable templates, and large Markdown projects.

🚀 Features

  • 🧩 Include one Markdown file into another
  • ⚡ Works recursively — assemble complex documents easily
  • 🧱 Keeps your docs modular and maintainable
  • 🪶 Simple, dependency-free, and lightweight

Installation

npm install md-compose

Usage

Use the special [[[ path/to/file.md ]]] syntax inside a Markdown document to include another Markdown file.

header.md

# Common Header for All Pages

footer.md

... and the second one in footer.md.

Follow me on [Github](https://github.com/fxxr)

page.md

[[[ header.md ]]]

...Page content...

[[[ footer.md ]]]

Code example

// Async version
import processIncludes from 'md-compose'
const result = await processIncludes('page.md')
console.log(result)

// Sync version
import {processIncludesSync} from 'md-compose'
const resultSync = await processIncludesSync('page.md')
console.log(resultSync)

Output:

# Common Header for All Pages

...Page content...

Follow me on [Github](https://github.com/fxxr)

Use cases

  • Combine multiple Markdown files into a single document
  • Reuse common sections like headers, footers, or legal disclaimers
  • Simplify large documentation or static site projects
  • Automate assembling Markdown files before publishing

Limitations

  • Only Markdown files with .md extension are supported
  • Only local relative paths are allowed
  • Paths are resolved relative to the current Markdown file
  • Parent directory references (..) are disallowed for safety

Contributing

Contributions, issues, and feature requests are welcome!
Open an issue or submit a pull request.

License

MIT © Anatoly Nechaev

About

A tiny Node.js tool to assemble Markdown from reusable fragments using a simple [[[include.md]]] syntax.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors