camacho/markdown-magic-directory-tree

Print directory tree in Markdown

41

stars

10

commits

JavaScript

primary language

Jul 5, 2026

updated

README

πŸ“¦ This package has moved. It now lives in the markdown-magic-plugins monorepo at packages/directory-tree. This repository is archived; issues and contributions go to the monorepo.

Directory tree plugin

Add directory tree to markdown files via markdown-magic

Install

npm i markdown-magic markdown-magic-directory-tree --save-dev

Adding the plugin

See example.js for usage.

import path from 'path';
import { markdownMagic } from 'markdown-magic';
import DIRTREE from './index.js';

const config = {
  matchWord: 'AUTO-GENERATED-CONTENT',
  transforms: {
    DIRTREE,
  },
};

const markdownPath = path.join(import.meta.dirname, 'README.md');
await markdownMagic(markdownPath, config);

Usage in markdown

markdown-magic-directory-tree/
β”œβ”€β”€ __fixtures__/
β”œβ”€β”€ __snapshots__/
β”œβ”€β”€ .github/
β”œβ”€β”€ example.js
β”œβ”€β”€ index.js
β”œβ”€β”€ index.spec.js
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ package.json
└── README.md

Options

  • dir - process.cwd() by default
  • ignore - ['.git', '.gitkeep', '.gitignore', 'node_modules'] by default
  • depth - Infinity by default (how deep in the tree to traverse)
  • onlyDirs - false by default (how mnuch t)

Contributors

camacho

8 commits

danethurber

2 commits

camacho/markdown-magic-directory-tree

Print directory tree in Markdown

41

stars

10

commits

JavaScript

primary language

Jul 5, 2026

updated

README

πŸ“¦ This package has moved. It now lives in the markdown-magic-plugins monorepo at packages/directory-tree. This repository is archived; issues and contributions go to the monorepo.

Directory tree plugin

Add directory tree to markdown files via markdown-magic

Install

npm i markdown-magic markdown-magic-directory-tree --save-dev

Adding the plugin

See example.js for usage.

import path from 'path';
import { markdownMagic } from 'markdown-magic';
import DIRTREE from './index.js';

const config = {
  matchWord: 'AUTO-GENERATED-CONTENT',
  transforms: {
    DIRTREE,
  },
};

const markdownPath = path.join(import.meta.dirname, 'README.md');
await markdownMagic(markdownPath, config);

Usage in markdown

markdown-magic-directory-tree/
β”œβ”€β”€ __fixtures__/
β”œβ”€β”€ __snapshots__/
β”œβ”€β”€ .github/
β”œβ”€β”€ example.js
β”œβ”€β”€ index.js
β”œβ”€β”€ index.spec.js
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ package.json
└── README.md

Options

  • dir - process.cwd() by default
  • ignore - ['.git', '.gitkeep', '.gitignore', 'node_modules'] by default
  • depth - Infinity by default (how deep in the tree to traverse)
  • onlyDirs - false by default (how mnuch t)

Contributors

camacho

8 commits

danethurber

2 commits

Languages

JavaScript

100.0%