markdown-join
v0.0.3
Published
A CLI tool to join Markdown files with custom directives.
Maintainers
Readme
markdown-join
A CLI and library for joining Markdown files with custom include/partial/set/var directives. Useful for modular documentation, knowledge bases, and static site generation.
Features
- CLI & API: Use as a command-line tool or import as a library
- Custom Directives: Supports
include,partial,set, andvarfor flexible content composition - Circular Include Detection: Prevents infinite loops
- TypeScript Support
Installation
npm install -g markdown-join # global CLI
# or
npm install markdown-join # as a project dependencyUsage
CLI
markdown-join <input.md> [-o output.md]
# or
mdj <input.md> [-o output.md]<input.md>: Input Markdown file-o, --output <output.md>: Output file (optional, defaults to stdout)
Example
markdown-join docs/index.md -o dist/README.mdAPI
import { joinMarkdown } from 'markdown-join';
const result = joinMarkdown('docs/index.md');
console.log(result);Directives
<!-- mdj:include file="path.md" -->— Include another Markdown file<!-- mdj:partial file="path.md" -->— Alias for include<!-- mdj:set var="foo" value="bar" -->— Set a variable<!-- mdj:var name="foo" -->— Insert a variable
Contributing
Pull requests and issues are welcome! Please open an issue to discuss major changes first.
- Fork the repo
- Create your feature branch (
git checkout -b feature/foo) - Commit your changes (
git commit -am 'Add foo') - Push to the branch (
git push origin feature/foo) - Open a pull request
License
MIT © natumsol
