GitHub MarkDown: Are Macros and Variables possible?

后端 未结 3 1266
忘了有多久
忘了有多久 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:47

    Below are a few ways to write Reference-Links

    [I'm an inline-style link](https://www.somewebsite.com)
    
    [I'm an inline-style link with title](https://www.somewebsite.com "somewebsite's Homepage")
    
    [I'm a reference-style link][Arbitrary case-insensitive reference text]
    
    [I'm a relative reference to a repository file](../blob/master/LICENSE)
    
    [You can use numbers for reference-style link definitions][1]
    
    Or leave it empty and use the [link text itself]
    
    Some text to show that the reference links can follow later.
    
    [arbitrary case-insensitive reference text]: https://www.somewebsite.org
    [1]: http://somewebsite.org
    [link text itself]: http://www.somewebsite.com
    
    0 讨论(0)
  • 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).

    0 讨论(0)
  • 2021-02-03 17:58

    You can use a feature of Markdown called "Reference-style links".

    [link text][id] or just [link text] if link-text is unique and consist only of letters, numbers, spaces and punctuation. They are not case sensitive.

    then somewhere in the document you define what id is:

    [id]: http://example.com/whatever

    See https://github.com/biserkov/markdown-playground/blob/master/README.md and

    https://raw.githubusercontent.com/biserkov/markdown-playground/master/README.md

    0 讨论(0)
提交回复
热议问题