An easy way is to use CSS classes as definitions and HTML tags as placeholders. Just write anywhere in your document a custom style or add it to your renderer:
<style>
area.varname1::after{content: "Berlin";}
area.varname2::after{content: "Budapest";}
...
</style>
The style
block won't be rendered but it will display the content
of your variables anywhere you use the empty area
HTML tag with the proper class
in your document. For example if you write:
<area class="varname1"> is a great place.
You should also see <area class="varname2"> one day.
Trains go to <area class="varname2"> from <area class="varname1"> regularly.
Will be rendered as:
Berlin is a great place.
You should also see Budapest one day.
Trains go to Budapest from Berlin regularly.
This trick works if your markdown processor use HTML (a lot does). The area
tag is great for this purpose as it is widely supported, rarely if ever used in markdown, short and can be empty. The ::after
CSS selector inserts content
as if it were originally written there, so all markdown formatting should work. For example: **<area class="varname1">**
should become bold: Berlin
This simple solution is bit of a hack for like occasionally used templates, but probably works in any environment with almost all markdown setups out of the box.