Usage
Quick start
Run the commands from your project folder. MDU finds the docs folder on its own.
mdu tree # show the page structure
mdu lint # report broken links and structure problems
mdu serve # preview the site with live reload
mdu render # write the static site to ./site
A typical workflow checks the pages, previews them while you write, and renders the site when you are ready to publish. Click a step to open its command page.
mdu serve opens the preview in your browser and updates it whenever you save a page or a linked image. Press Ctrl+C to stop it. Rendering never changes your Markdown files.
A lint error names the file, line, rule, and problem:
/project/docs/Overview.md:7: MDU004 LocalLinkExists: Local link target './intro.md' does not exist.
Linter detected 1 error.
Commands
| Command | Syntax | Purpose |
|---|---|---|
| tree | mdu tree [path] |
Print the detected page structure. Alias: print |
| lint | mdu lint [path] |
Check pages and local links against the rules. Alias: l |
| fix | mdu fix [path] |
Migrate MkDocs syntax and apply automatic fixes |
| render | mdu render [path] [outpath] |
Write a static HTML site. Alias: r |
| serve | mdu serve [path] [outpath] |
Serve a local preview that updates on changes |
mdu pdf [path] [outpath] |
Write one PDF file | |
| page move | mdu page move <source> <target> |
Move a page or folder and update every link to it. Alias: page mv |
| page links | mdu page links <file> |
List the links that point to a file |
Paths and file search
| Default | |
|---|---|
| Source folder | ./docs. Pass the path explicitly if it does not exist. |
Output of render and serve |
./site, with documentation.pdf when a page contains a PDF Link |
Output of pdf |
./documentation.pdf |
| Pages | Files matching *.md |
mdu render ./ProjectDocs ./public/docs
mdu serve --port 8080
Common options
tree, lint, fix, render, serve, and pdf share these options:
| Option | Effect |
|---|---|
-p, --pattern <pattern> |
Search for files matching the pattern. Default: *.md. |
--hidden |
Include hidden files. Default: on; --hidden false leaves them out. |
-?, -h, --help |
Show help for the command. |
Command pages list the additional options. mdu <command> --help always shows the current help.