XMD Documentation

XMD Documentation

Welcome to XMD - eXtended MarkDown processor with advanced scripting capabilities.

Getting Started

User Guide

Language Reference

Variables

  • Set variables with set
  • Use variables with ``
  • Support for strings, numbers, booleans, arrays, objects
  • Array literals: ["item1", "item2", "item3"]
  • Variable initialization: set varname (without assignment)

Advanced Scripting

  • Array Processing: Iterate over arrays with for item in array
  • String Concatenation: Use + operator for string combination
  • Compound Assignment: Use += for accumulating content
  • Dynamic Imports: import variable_name where variable contains filename
  • Expression Evaluation: Complex expressions like "prefix " + import file + " suffix"

Commands

  • Execute with exec
  • Capture output with set var = exec command
  • Dynamic buffer allocation for large command outputs
  • Security controls with --no-exec

Functions

  • print(variable) - Output variable value
  • cmd("command") - Execute and return output

Control Flow

  • if/elif/else/endif - Conditional execution
  • for/endfor - Loop over arrays and ranges
  • Advanced for loops with bodies and indentation
  • Logical operators: &&, ||, !

Script Blocks

<!-- xmd:
set files = ["config.md", "setup.md", "deploy.md"]
set documentation = ""
for file in files
    documentation += "## " + import file + "\n\n"
-->

Developer Guide

Support