GitHub MarkDown: Are Macros and Variables possible?

后端 未结 3 1311
忘了有多久
忘了有多久 2021-02-03 17:08

I\'ve been learning github markdown, I had a question about variables and macros.

is it possible to define a variable or macro to prevent repeated printing of a block of

3条回答
  •  没有蜡笔的小新
    2021-02-03 17:49

    GitHub Markdown (for .md files) has variables through capture:

    {% capture nameOfVariableToCapture %}any markdown here...{% endcapture %}
    
    {{ nameOfVariableToCapture }} -- that prints the content of the variable
    

    or from {% assign variableName = "text etc." %}.

    As a test, I created https://github.com/SeLite/SeLite.github.io/blob/master/MarkdownTest.md. You can see its content at http://selite.github.io/MarkdownTest (ignore the header and footer, that comes from a framework).

提交回复
热议问题