Skip to content

Instantly share code, notes, and snippets.

@possibilities
Created July 8, 2025 18:16
Show Gist options
  • Save possibilities/7bfe3f471e374bbb12218c840bae1c24 to your computer and use it in GitHub Desktop.
Save possibilities/7bfe3f471e374bbb12218c840bae1c24 to your computer and use it in GitHub Desktop.

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.md
$ 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>

Install

npm install tag-composer

CLI

tag-composer input.md

Learn 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment