GitHub MarkDown: Are Macros and Variables possible?

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:

  • The table (which has ~10 columns and ~10 rows) is a bit easier to see on a normal screen, at the moment with the prefix to the links being so long, it looks really ugly as the links wrap to the next line
  • If I want to change the root link, I can change it in one place (yes, I know I could do search and replace in an editor!)

Cheers.


Solution 1:

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

Solution 2:

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