tag-composer
v0.1.6
Published
Tag Composer CLI
Downloads
28
Readme
Tag Composer
Compose the content of markdown files into an xml-like tag structure.
What does it do?
Tag Composer processes markdown files that can reference other markdown files using @@ syntax, and outputs XML with the composed content wrapped in tags based on file paths.
$ tree docs/
docs/
├── index.md
├── intro.md
└── api/
├── overview.md
└── methods.md$ cat docs/index.md
Documentation
@@docs/intro.md
@@docs/api/overview.mdNote: All @@ directive paths are resolved relative to the entrypoint file (the file specified on the command line). Absolute paths (starting with /) are used as-is.
$ cat docs/intro.md
Welcome to our project!
This is the introduction.$ tag-composer docs/index.md
<document>
<docs>
<index>
Documentation
<intro>
Welcome to our project!
This is the introduction.
</intro>
<api>
<overview>
API Overview content here...
</overview>
</api>
</index>
</docs>
</document>The CLI and library support various options to control how tags are generated and structured. You can customize the root tag name, change indentation, modify how file paths are converted to tags, flatten the tag hierarchy, and merge duplicate tags. See the CLI Guide and Library Guide for all available options.
Install
pnpm add tag-composerCLI
tag-composer input.mdLearn more in the CLI Guide
Library
import { composeTags } from 'tag-composer'
const output = composeTags('input.md')
console.log(output)Learn more in the Library Guide
Tasks
- [ ] Split into CLI and Library packages to avoid taking on CLI dependencies in the library
