Markdown Toolbox Logo Markdown Toolbox
Privacy Policy

Using Variables in Markdown Files

Wednesday, November 15, 2023

Short version

Markdown itself does not support variables directly. Use pre-processors like Jekyll, Pandoc, or Markdown Preprocessor (MPP) for variable support.

Long version


Variables in documents can greatly enhance the flexibility and reuse of the content. However, Markdown's simplicity means it doesn't natively support variables.


To use variables in Markdown, you'll typically employ a pre-processor or a static site generator that supports Markdown.

name: John Doe
Hello, my name is {{ name }}.
pandoc --variable=author:"John Doe" -o output.docx


While Markdown doesn't directly support variables, using tools like Jekyll or Pandoc allows you to add dynamic content to your Markdown documents. This approach leverages the simplicity of Markdown while adding the flexibility of variables.