---
title: Variables in Markdown
description: In this short article we'll take a look at a how we can use variables in Markdown documents.
date: 2020-11-03
tags: Markdown
source: https://brianchildress.co/blog/variables-in-markdown
---

# Variables in Markdown

I recently needed to create a Markdown document that contained the same couple of values throughout the document. The developer in me hates to copy/paste anything more than a couple of times if it has the potential to ever change. So I looked for a way to assign a variable in Markdown.

The idea is pretty simple, Markdown has a concept of _reference links_ or _[reference-style links](https://daringfireball.net/projects/markdown/syntax#link)_ that allows us to define a value to a reference _variable_ and then refer to that value later in the same document.

```md
This is my [random value] located somewhere in my Markdown document.

[random value]: variable value
```

In this example the _[random value]_ will be replaced with the "variable value" anywhere it appears. A simple, yet powerful way to approach Markdown.
