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 text?
The use case is that I have a table producing a big grid of hyperlinks - the links look like the below.
http://www.a-big-long-big-big-long-hyperlink/more-long-stuff?id=1234
it would be nice if I could do something like the below once:
$link=http://www.a-big-long-big-big-long-hyperlink/more-long-stuff?id
and then in each cell in the table, I can say something like
$link=1234
Some other cell
$link=2345
the idea being that:
Cheers.
The idea is pretty simple, Markdown has a concept of reference links or reference-style links that allows us to define a value to a reference variable and then refer to that value later in the same document.
GitHub uses its own Markdown processor; GitHub Pages uses jekyll-commonmark. This means your README.md file will look different on GitHub's website than on your GitHub Pages website.
Wherever HTML is rendered on GitHub (gists, README files in repos, comments on issues and pull requests, ...) you can use any of the HTML elements that GitHub Flavored Markdown (GFM) provides syntactic sugar for.
You can edit the Readme.md file in GitHub itself. Click on Readme.md, you will find an edit button. You can preview your changes and even commit them from there. Since it is a text file, Notepad or Notepad++ (Windows), TextEdit (Mac) or any other text editor can be used to edit and modify it.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With