Skip to main content
The example command creates a pre-populated markdown file that demonstrates all supported features including syntax highlighting, Mermaid diagrams, tables, and formatting options.

Usage

Arguments

Path
default:"example.md"
Output path for the generated showcase markdown file.Behavior:
  • If OUTPUT is a directory, the file is created as OUTPUT/example.md
  • If OUTPUT is a file path, uses that exact path
  • Parent directories are created automatically if they don’t exist
  • Tilde (~) expansion is supported
Source: cli.py:273-276

Options

bool
default:"false"
Automatically open the generated example file in the Markdown-OS editor after creation.When enabled, this flag chains the example command with open, equivalent to:
Source: cli.py:277-281
bool
default:"false"
Overwrite existing files without prompting for confirmation.Aliases: -f, --forceWithout this flag, if the output file exists, you’ll be prompted:
Source: cli.py:282-287

Examples

Terminal Output

Success

With —open Flag

Overwrite Prompt

With —force Flag

Template Source

The example content is loaded from a bundled template file:
This template is included in the package distribution and demonstrates:
  • Headings (H1-H6)
  • Text formatting (bold, italic, code)
  • Lists (ordered, unordered, nested)
  • Code blocks with syntax highlighting
  • Mermaid diagrams
  • Tables
  • Blockquotes
  • Horizontal rules
  • Links and images
Source: cli.py:201-213

Behavior Details

Path Resolution

  1. Tilde expansion: ~/docs/example.md/home/user/docs/example.md
  2. Directory detection: If path exists and is a directory, appends /example.md
  3. Absolute path: All paths are resolved to absolute before writing
Source: cli.py:184-198

File Writing Process

  1. Parent directory creation: mkdir -p equivalent (parents=True, exist_ok=True)
  2. Template loading: Read from package resources (UTF-8 encoding)
  3. Write operation: Save with UTF-8 encoding
  4. Success message: Print green confirmation with full resolved path
  5. Next step hint: Show suggested open command
  6. Optional open: If --open flag, chain to open_markdown_file()
Source: cli.py:301-332

Overwrite Protection

When the output file exists:
Source: cli.py:303-310

Error Handling

Error handling source: cli.py:312-324

Exit Codes

Use Cases

Quick Start

Generate an example and immediately start editing to learn the features:

Documentation Template

Create a template for team documentation:

Testing Features

Generate a file to test syntax highlighting and Mermaid rendering:

CI/CD Integration

Generate examples in automated scripts:
The generated example file is a static snapshot of the template. It does not auto-update when the package is upgraded. To get the latest template, regenerate the file with --force.