| title | Getting Started |
|---|---|
| description | Learn how to install and use markdown-magic with quick start examples, CLI usage, and basic configuration |
Install markdown-magic as a development dependency:
npm install markdown-magic --save-devAdd comment blocks to your markdown files to define where content should be generated:
<!-- docs remote url=http://url-to-raw-md-file.md -->
This content will be dynamically replaced from the remote url
<!-- /docs -->Then run markdown-magic to process your files.
Run markdown --help to see all available CLI options:
markdown
# or
md-magicProcess all markdown files in current directory:
md-magicProcess specific files with custom config:
md-magic --files '**/*.md' --config ./config.file.jsAdd to your package.json:
{
"scripts": {
"docs": "md-magic --files '**/*.md'"
}
}Run with: npm run docs
Create an md.config.js or markdown.config.js file in your project root for automatic configuration:
module.exports = {
matchWord: 'doc-gen',
transforms: {
// your custom transforms
}
}const { markdownMagic } = require('../src')
/* By default all .md files in cwd will be processed */
markdownMagic().then((results) => {
console.log('result keys', Object.keys(results))
})import path from 'path'
import markdownMagic from 'markdown-magic'
// Process a Single File
const markdownPath = path.join(__dirname, 'README.md')
markdownMagic(markdownPath)- Check out the Syntax Reference for all available syntax options
- Learn about Advanced Usage patterns
- Explore Plugin Development to create custom transforms