12 contents, collapsible content and footnotes - practicalseries/GitHub-Wiki-Design-and-Implementation GitHub Wiki

PAL Logo showing Wiki Documentation heading

12SpacerContents, collapsible content and footnotes

Tables of contents (TOCs) form an important part of a Wiki, PracticalSeries Wikis all have a table of contents in the sidebar, these are in a collapsible form that can be expanded or contracted by clicking a small black arrow at the side of the link.

Each entry in the TOC is a link that navigates to the appropriate section when clicked. This section explains how to construct a table of contents, how to make it collapsible and how to automatically produce the TOC entries.

Footnotes are also covered in this section. Footnotes are a peculiarity with GitHub Wikis; normally, footnotes can be created directly in the Markdown and using specific formatting characters that tell GitHub it’s a footnote and GitHub then creates a link to the footnote entry and from there, back to the original point in the body text. At least it does in normal Markdown files in a repository.

For some reason, footnotes don’t work in Wiki Markdown files. I have no reason why this should be. But there we go.

I’ve come up with a workaround to allow footnotes and their linkage to work on Wiki pages, and it is explained in this section.

⬆️ Top



12.1SpacerA basic table of contents

A table of contents (TOC) is simply a list of the heading on a page (or on many Wiki pages) that form navigable links to the appropriate page and heading.

These links are identical to those discussed in section 9.3 and section 9.4. The following is an extract of the TOC from this Wiki (it appears in the sidebar of the following page: https://github.com/practicalseries/GitHub-Wiki-Design-and-Implementation/wiki/01-Introducing-the-GitHub-Wiki).

Table of contents
Figure 12.1 β€” Table of contents in a sidebar

The Markdown behind this is:

Markdown and GitHub output
${\large \color{#0050C0}\text{M\ A\ R\ K\ D\ O\ W\ N}}$ πŸ”½

&emsp;&emsp;&ensp;&thinsp;&hairsp;[Home](home)<br><!-- HOME -->

&emsp;&emsp;&ensp;&thinsp;&hairsp;[Casenotes](casenotes)<br><!-- CASENOTES -->

&emsp;&emsp;&ensp;&thinsp;&hairsp;[The licences and other details](licence)<br><!-- LICENCE -->
&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&nbsp;[The Licence](licence#the-licence)<br>
&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&nbsp;[Why did I choose the MIT Licence?](licence#why-did-i-choose-the-mit-licence)<br>
&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&nbsp;[Permissive licences](licence#permissive-licences)<br>
&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&nbsp;[Copyleft licence](licence#copyleft-licence)<br>
&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&nbsp;[Limiting liabilities](licence#limiting-liabilities)<br>
&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&nbsp;[Which licence to use?](licence#which-licence-to-use)<br>
&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&nbsp;[A note on spelling](licence#a-note-on-spelling-licence-or-license)<br>

&ensp;&nbsp;&nbsp;[1&ensp;&nbsp;&nbsp;&thinsp;Introducing the GitHub Wiki](01-Introducing-the-GitHub-Wiki)<br><!--SEC 01 -->
&emsp;&ensp;&hairsp;[1.3&emsp;&emsp;&nbsp;&nbsp;&thinsp;&hairsp;Creating a Wiki](01-Introducing-the-GitHub-Wiki#13creating-a-wiki-for-a-repository)<br>

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ πŸ”½

β€ƒβ€ƒβ€‚β€‰β€ŠHome

β€ƒβ€ƒβ€‚β€‰β€ŠCasenotes

β€ƒβ€ƒβ€‚β€‰β€ŠThe licences and other details
       The Licence
       Why did I choose the MIT Licence?
       Permissive licences
       Copyleft licence
       Limiting liabilities
       Which licence to use?
       A note on spelling

   1   β€‰Introducing the GitHub Wiki
β€ƒβ€‚β€Š1.3    β€‰β€ŠCreating a Wiki

Table 12.1 β€” A basic table of contents in Markdown

Note

The <br> at the end of each line is required (the lines join up otherwise).

Ignoring all the special space characters at the start (these are just used to pad the links to the correct indentation), it becomes:

Markdown and GitHub output
${\large \color{#0050C0}\text{M\ A\ R\ K\ D\ O\ W\ N}}$ πŸ”½

[Home](home)<br>

[Casenotes](casenotes)<br>

[The licences and other details](licence)<br>
[The Licence](licence#the-licence)<br>
[Why did I choose the MIT Licence?](licence#why-did-i-choose-the-mit-licence)<br>
[Permissive licences](licence#permissive-licences)<br>
[Copyleft licence](licence#copyleft-licence)<br>
[Limiting liabilities](licence#limiting-liabilities)<br>
[Which licence to use?](licence#which-licence-to-use)<br>
[A note on spelling](licence#a-note-on-spelling-licence-or-license)<br>

[1. Introducing the GitHub Wiki](01-Introducing-the-GitHub-Wiki)<br>

Table 12.2 β€” A simplified table of contents

These are just standard markdown links covered in section 9.4, they are in the form:

     ${\LARGE \color{#0050C0}\text{[}\color{#C00000}\text{Substitute\ Text}\color{#0050C0}\text{](}\color{#4B0082}\text{pageName}}$Hash${\LARGE \color{#1F883D}\text{headingName}\color{#0050C0}\text{)}}$

If the link is just to a Wiki page (it will load at the top of the page), this is simplified to:

     ${\LARGE \color{#0050C0}\text{[}\color{#C00000}\text{Substitute\ Text}\color{#0050C0}\text{](}\color{#4B0082}\text{pageName}\color{#0050C0}\text{)}}$

The HTML equivalent is:

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ πŸ”½

&emsp;&emsp;&ensp;&thinsp;&hairsp;<a href="home">Home</a><br>

&emsp;&emsp;&ensp;&thinsp;&hairsp;<a href="casenotes">Casenotes</a><br>

&emsp;&emsp;&ensp;&thinsp;&hairsp;<a href="licence">The licences and other details</a><br>
&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&nbsp;<a href="licence#the-licence">The Licence</a><br>
&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&nbsp;<a href="licence#why-did-i-choose-the-mit-licence">Why did I choose the MIT Licence?</a><br>
&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&nbsp;<a href="licence#permissive-licences">Permissive licences</a><br>
&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&nbsp;<a href="licence#copyleft-licence">Copyleft licence</a><br>
&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&nbsp;<a href="licence#limiting-liabilities">Limiting liabilities</a><br>
&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&nbsp;<a href="licence#which-licence-to-use">Which licence to use?</a><br>
&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&nbsp;<a href="licence#a-note-on-spelling-licence-or-license">A note on spelling</a><br>

&ensp;&nbsp;&nbsp;<a href="01-Introducing-the-GitHub-Wiki">1&ensp;&nbsp;&nbsp;&thinsp;Introducing the GitHub Wiki</a><br>
&emsp;&ensp;&hairsp;<a href="01-Introducing-the-GitHub-Wiki#13creating-a-wiki-for-a-repository">1.3&emsp;&emsp;&nbsp;&nbsp;&thinsp;&hairsp;Creating a Wiki</a><br>

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ πŸ”½

β€ƒβ€ƒβ€‚β€‰β€ŠHome

β€ƒβ€ƒβ€‚β€‰β€ŠCasenotes

β€ƒβ€ƒβ€‚β€‰β€ŠThe licences and other details
       The Licence
       Why did I choose the MIT Licence?
       Permissive licences
       Copyleft licence
       Limiting liabilities
       Which licence to use?
       A note on spelling

   1   β€‰Introducing the GitHub Wiki
β€ƒβ€‚β€Š1.3    β€‰β€ŠCreating a Wiki

Table 12.3 β€” The basic table of contents in HTML

Again, these are in the standard HTML format for a link to a point on a page:

     ${\LARGE \color{#0050C0}\text{&lt;a\ href="}\color{#4B0082}\text{pageName}}$Hash${\LARGE \color{#1F883D}\text{headingName}\color{#0050C0}\text{"&gt;}\color{#C00000}\text{Substitute\ Text}\color{#0050C0}\text{&lt;/a&gt;}}$

The #headingName can be omitted if linking to the top of the page

⬆️ Top



12.2SpacerUnderstanding the space characters

In the above example (either Markdown or HTML) there are strings of special space characters at the start of each line (an example is shown below):

Markdown and GitHub output
${\large \color{#0050C0}\text{M\ A\ R\ K\ D\ O\ W\ N}}$ πŸ”½

&emsp;&ensp;&hairsp;[1.3.1&emsp;&nbsp;&nbsp;&nbsp;&nbsp;The first page]...

Table 12.4 β€” Special space characters in a TOC

These are used to indent the links so that they all line up, the alignment is as follows:

Table of contents
Figure 12.2 β€” Table of contents alignment in a sidebar

The general arrangement is that the chapter numbers all align on the left edge (with allowances for a collapsible area arrow, see section 12.4), this is shown by the solid pink line.

Section and subsection numbers are indented one numerical character (to align with a second digit of a chapter number), dotted pink line.

Chapter heading text is indented to align with the first full stop in a two-digit section number, dotted orange line.

If unnumbered chapter headings are used (CaseNotes and Home in the example of the previous section), these are indented to the same position, again, the dotted orange line.

Section and subsection texts are indented sufficiently to allow a number in the form nn.nn.nn (i.e. three, two-digit numbers) to precede the text, dotted green line.

These spacings are created by the strings of special space characters, e.g.:

   &emsp;&emsp;&ensp;&thinsp;&hairsp;

These force a correctly spaced gap before the heading number and heading text in the table of contents. By being inserted before the opening bracket, they do not form part of the heading itself, indenting the underline bar that indicates a clickable link.

These special space characters just make everything line up correctly and give a pleasing appearance. They are used extensively within the PracticalSeries Wikis and are discussed further in section 16.6.

⬆️ Top



12.3SpacerCollapsible content

Content within Markdown pages can be made collapsible (effectively hidden from view until clicked). Such content is often used within tables of contents, but can also be used for any text and even images.

The following shows two examples of collapsible content:

An example of lorem ipsum Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur tortor a tortor ornare, non pretium diam faucibus. Morbi ut mollis dolor, nec pretium tellus. Suspendisse ornare neque placerat orci aliquam, eu sodales dui blandit.
A picture of Henry
Henry
Figure 1.1 β€” Henry the dog

Clicking either of the two right-pointing arrows above will display the hidden content (shown open below):

An example of lorem ipsum Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur tortor a tortor ornare, non pretium diam faucibus. Morbi ut mollis dolor, nec pretium tellus. Suspendisse ornare neque placerat orci aliquam, eu sodales dui blandit.
A picture of Henry
Henry
Figure 1.1 β€” Henry the dog

When the content is expanded, the arrows point downwards (clicking the arrow again collapses the content once more).

Collapsible content is only possible with HTML, the code behind the first β€œlorem ipsum” example above is:

HTML
${\large \color{#00C050}\text{H\ T\ M\ L}}$ πŸ”½

<details><!-- START OF COLLAPSIBLE AREA -->
<summary>An example of lorem ipsum</summary><!-- VISIBLE TEXT -->
<!-- HIDDEN CONTENT -->Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur tortor a tortor ornare, non pretium diam faucibus. Morbi ut mollis dolor, nec pretium tellus. Suspendisse ornare neque placerat orci aliquam, eu sodales dui blandit.
</details><!-- END OF COLLAPSIBLE AREA -->

Table 12.5 β€” HTML for collapsible content

The format for any collapsible content is:

HTML
${\large \color{#00C050}\text{H\ T\ M\ L}}$ πŸ”½

${\color{#0050C0}\text{&lt;details&gt;}}$
${\color{#0050C0}\text{&lt;summary&gt;}\color{#C00000}\text{VisibleText}\color{#0050C0}\text{&lt;/summary&gt;}}$
${\color{#1F883D}\text{HiddenContent}}$
${\color{#0050C0}\text{&lt;/details&gt;}}$

The ${\color{#0050C0}\text{&lt;details&gt;}}$ tag is used to identify an area that contains additional information (details) that the user can open on demand.

The ${\large \color{#0050C0}\text{&lt;details&gt;}}$ tag is usually followed by a ${\large \color{#0050C0}\text{&lt;summary&gt;}}$ tag, anything within the ${\large \color{#0050C0}\text{&lt;summary&gt;}}$ tag becomes a ${\large \color{#C00000}\text{VisibleText}}$ heading for the ${\large \color{#0050C0}\text{&lt;details&gt;}}$ tag, it is always displayed and will have the little right-pointing arrow next to it.

Everything else between the ${\large \color{#0050C0}\text{&lt;details&gt;}}$ tags that is not enclosed in a ${\large \color{#0050C0}\text{&lt;summary&gt;}}$ tag will be hidden until the right-pointing arrow is clicked.

Note

There should only be one <summary> tag per <details> tag, if more than one is included, only the first will be displayed, subsequent entries will be shown as unordered list points

For completeness, the HTML for the second β€œHenry” picture is:

HTML
${\large \color{#00C050}\text{H\ T\ M\ L}}$ πŸ”½

<details><!-- START OF COLLAPSIBLE AREA -->
<summary>A picture of Henry</summary><!-- VISIBLE TEXT -->
<table align="center"><tr><td><!-- HIDDEN CONTENT -->
  <img width="400" src="11-0000/02-images/figm-99-01.png" alt="Henry">
  </td></tr>
  <tr><th align="center"><sup>Figure 1.1 &mdash; Henry the dog</sup></th></tr>
</table>
</details><!-- END OF COLLAPSIBLE AREA -->

Table 12.6 β€” HTML for collapsible image in a table

⬆️ Top



12.3.1SpacerDefaulting to open

By default, collapsible areas are closed when a page loads, it is possible to force a collapsible area to default to the expanded state by using the ${\large \color{#00B050}\text{open}}$ attribute within the ${\large \color{#0050C0}\text{&lt;details&gt;}}$ tag:

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ πŸ”½

<details open><!-- START OF COLLAPSIBLE AREA -->
<summary>An example of lorem ipsum</summary><!-- VISIBLE TEXT -->
<!-- HIDDEN CONTENT -->Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur tortor a tortor ornare, non pretium diam faucibus. Morbi ut mollis dolor, nec pretium tellus. Suspendisse ornare neque placerat orci aliquam, eu sodales dui blandit.
</details><!-- END OF COLLAPSIBLE AREA -->

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ πŸ”½
An example of lorem ipsum Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur tortor a tortor ornare, non pretium diam faucibus. Morbi ut mollis dolor, nec pretium tellus. Suspendisse ornare neque placerat orci aliquam, eu sodales dui blandit.
Table 12.7 β€” An expanded by default collapsible area

This causes the hidden text to be expanded by default when the page loads (clicking the arrow will close the expanded area as normal).

⬆️ Top



12.3.2SpacerMarkdown restrictions

There are certain restrictions with the ${\large \color{#0050C0}\text{&lt;summary&gt;}}$ tag:

It is not possible to put Markdown links (or indeed any Markdown formatting, not even **) inside a <summary> tag.

Any link or formatting that is required inside the ${\large \color{#0050C0}\text{&lt;summary&gt;}}$ tag must use HTML.

HTML can be used in the ${\large \color{#1F883D}\text{HiddenContent}}$ area, however, to do so there must be a blank line following the closing ${\large \color{#0050C0}\text{&lt;/summary&gt;}}$ tag.

⬆️ Top



12.4SpacerCollapsible TOC

The most widely used application of collapsible content is to manage tables of content.

Within the PracticalSeries Wikis, the TOC in the sidebar uses collapsible content to display only the chapter numbers and headings (the sections and subsections for each chapter being hidden). The contents for the current page are, however, expanded showing the section and subsections for that page.

The following is the sidebar TOC for chapter 2 of this Wiki:

Table of contents
Figure 12.3 β€” Collapsible TOC

To explain the collapsible TOC, consider the HTML (and Markdown) behind the chapter 2 TOC entry above:

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ πŸ”½

<details open><!-- SECTION 02 -->
<summary><a href="02-Cloning-a-Wiki">2&ensp;&nbsp;&nbsp;&thinsp;Cloning a Wiki</a>
</summary><!-- BLANK LINE BELOW -->

&emsp;&ensp;&hairsp;[2.1&emsp;&emsp;&nbsp;&nbsp;&thinsp;&hairsp;Why clone a Wiki?](02-Cloning-a-Wiki#21why-clone-a-wiki-to-a-local-machine)<br>
&emsp;&ensp;&hairsp;[2.2&emsp;&emsp;&nbsp;&nbsp;&thinsp;&hairsp;How to clone a Wiki](02-Cloning-a-Wiki#22how-to-clone-a-wiki-to-a-local-machine)<br>
&emsp;&ensp;&hairsp;[2.3&emsp;&emsp;&nbsp;&nbsp;&thinsp;&hairsp;Pushing changes to GitHub](02-Cloning-a-Wiki#23pushing-wiki-changes-back-to-github)<br>
&emsp;&ensp;&hairsp;[2.3.1&emsp;&nbsp;&nbsp;&nbsp;&nbsp;Configuring the Git credentials](02-Cloning-a-Wiki#231configuring-the-git-username-and-email-address)<br>
&emsp;&ensp;&hairsp;[2.3.2&emsp;&nbsp;&nbsp;&nbsp;&nbsp;Commit and synchronise to GitHub](02-Cloning-a-Wiki#232committing-the-changes-and-synchronising-with-github)<br>
</details><!-- END OF COLLAPSIBLE AREA -->

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ πŸ”½
2   β€‰Cloning a Wiki

β€ƒβ€‚β€Š2.1    β€‰β€ŠWhy clone a Wiki?
β€ƒβ€‚β€Š2.2    β€‰β€ŠHow to clone a Wiki
β€ƒβ€‚β€Š2.3    β€‰β€ŠPushing changes to GitHub
β€ƒβ€‚β€Š2.3.1     Configuring the Git credentials
β€ƒβ€‚β€Š2.3.2     Commit and synchronise to GitHub

Table 12.8 β€” HTML for collapsible TOC

This collapsible TOC is simply a collapsible content area that contains links in a similar fashion to the basic TOC in section 12.1.

The only differences being that the visible link contained within the ${\large \color{#0050C0}\text{&lt;summary&gt;}}$ tag is coded as HTML (Markdown formatting is not permitted within the ${\large \color{#0050C0}\text{&lt;summary&gt;}}$ tag, see section 12.3.2) and the ${\large \color{#0050C0}\text{&lt;/summary&gt;}}$ tag is followed by a blank line.

The blank line after the ${\large \color{#0050C0}\text{&lt;/summary&gt;}}$ tag is necessary for GitHub, if it is not present, GitHub will not render the Markdown links correctly.

Once collapsible TOCs have been created for each chapter (in a particular sidebar), they can be copied en-masse to all other sidebars (all sidebars have the same contents allowing navigation to any page in the Wiki).

The only distinction between the sidebars, is that the TOC for the chapter associated with the current page should be set to ${\large \color{#00B050}\text{open}}$.

⬆️ Top



12.5SpacerTOCs in tables

TOCs can be inserted directly into HTML table (they can be inserted in to Markdown tables too, but Markdown tables require a heading row which isn’t required with a TOC).

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ πŸ”½

<table align="center">
<tr>
<td width="425" valign="top">
<details><!-- SECTION 01 -->
<summary><a href="https://github.com/practicalseries/GitHub-Wiki-Design-and-Implementation/wiki/01-Introducing-the-GitHub-Wiki">1&ensp;&nbsp;&nbsp;&thinsp;Introducing the GitHub Wiki</a>
</summary><!-- BLANK LINE BELOW -->

&emsp;&emsp;&emsp;&emsp;&emsp;&ensp;&nbsp;[A note by the Author](01-Introducing-the-GitHub-Wiki#a-note-by-the-author)<br>
&emsp;&ensp;&hairsp;[1.1&emsp;&emsp;&nbsp;&nbsp;&thinsp;&hairsp;What are GitHub Wiki pages?](01-Introducing-the-GitHub-Wiki#11what-are-github-wiki-pages)<br>
&emsp;&ensp;&hairsp;[1.2&emsp;&emsp;&nbsp;&nbsp;&thinsp;&hairsp;Understanding the Wiki pages](01-Introducing-the-GitHub-Wiki#12understanding-the-wiki-pages)<br>
&emsp;&ensp;&hairsp;[1.3&emsp;&emsp;&nbsp;&nbsp;&thinsp;&hairsp;Creating a Wiki for a repository](01-Introducing-the-GitHub-Wiki#13creating-a-wiki-for-a-repository)<br>
&emsp;&ensp;&hairsp;[1.3.1&emsp;&nbsp;&nbsp;&nbsp;&nbsp;Creating the first Wiki page](01-Introducing-the-GitHub-Wiki#131creating-the-first-wiki-page)<br>
</details>
</td>

<td width="425" valign="top">
<details><!-- SECTION 02 -->
<summary><a href="02-Cloning-a-Wiki">2&ensp;&nbsp;&nbsp;&thinsp;Cloning a Wiki</a>
</summary><!-- BLANK LINE BELOW -->

&emsp;&ensp;&hairsp;[2.1&emsp;&emsp;&nbsp;&nbsp;&thinsp;&hairsp;Why clone a Wiki?](02-Cloning-a-Wiki#21why-clone-a-wiki-to-a-local-machine)<br>
&emsp;&ensp;&hairsp;[2.2&emsp;&emsp;&nbsp;&nbsp;&thinsp;&hairsp;How to clone a Wiki](02-Cloning-a-Wiki#22how-to-clone-a-wiki-to-a-local-machine)<br>
&emsp;&ensp;&hairsp;[2.3&emsp;&emsp;&nbsp;&nbsp;&thinsp;&hairsp;Pushing changes to GitHub](02-Cloning-a-Wiki#23pushing-wiki-changes-back-to-github)<br>
&emsp;&ensp;&hairsp;[2.3.1&emsp;&nbsp;&nbsp;&nbsp;&nbsp;Configuring the Git credentials](02-Cloning-a-Wiki#231configuring-the-git-username-and-email-address)<br>
&emsp;&ensp;&hairsp;[2.3.2&emsp;&nbsp;&nbsp;&nbsp;&nbsp;Commit and synchronise to GitHub](02-Cloning-a-Wiki#232committing-the-changes-and-synchronising-with-github)<br>
</details>
</td></tr>
</table>




It looks like this:

1   β€‰Introducing the GitHub Wiki

       A note by the Author
β€ƒβ€‚β€Š1.1    β€‰β€ŠWhat are GitHub Wiki pages?
β€ƒβ€‚β€Š1.2    β€‰β€ŠUnderstanding the Wiki pages
β€ƒβ€‚β€Š1.3    β€‰β€ŠCreating a Wiki for a repository
β€ƒβ€‚β€Š1.3.1     Creating the first Wiki page

2   β€‰Cloning a Wiki

β€ƒβ€‚β€Š2.1    β€‰β€ŠWhy clone a Wiki?
β€ƒβ€‚β€Š2.2    β€‰β€ŠHow to clone a Wiki
β€ƒβ€‚β€Š2.3    β€‰β€ŠPushing changes to GitHub
β€ƒβ€‚β€Š2.3.1     Configuring the Git credentials
β€ƒβ€‚β€Š2.3.2     Commit and synchronise to GitHub

Table 12.9 β€” TOC in a table

The code for the collapsible TOC is the same as in the previous section (it starts and ends with the <details> tags).

Around this is the code for a one-row, two-column table.

The only thing of note here is that each cell is set to a width of 425 px to make the column widths equal and each is vertically aligned to the top, this stops the alternate column from centring vertically when one TOC is expanded and the other isn’t.

⬆️ Top



12.6SpacerFootnotes

Footnotes are a slightly peculiar topic for the following reason:

GitHub Markdown has a structure for footnotes that works in Markdown files in a repository (a README.md file for example); the same structure does not, however, work in Wiki Markdown files.

In a repository Markdown file a footnote is indicated by entering [^nnn], where nnn is a unique identifier (usually a number indicating the number of the footnote).

The footnote text is given at some other point in the file with the format [^nnn]: FootnoteText. Here is an example:

Markdown and GitHub output
${\large \color{#0050C0}\text{M\ A\ R\ K\ D\ O\ W\ N}}$ πŸ”½

The LOX pump delivered fuel at the rate of 24,811 gallons per minute [^1] and the kerosene from the tankage to the combustion chamber at the rate of 15,741 gallons per minute.

[^1]: it would have filled a swimming pool twenty-five feet long, ten feet wide, and six feet deep in twenty-seven seconds.

Table 12.10 β€” A typical footnote in a repository Markdown file

It looks like this in a repository README.md file:

Read.me footnote
Figure 12.4 β€” A footnote in a repository Markdown file

The footnote reference appears as a superscript 1 in brackets, point β‘  above. The footnote itself appears at the end of the page, point β‘‘ (irrespective of where the footnote text is entered on the page). Clicking the footnote reference, point β‘ , navigates to the footnote text, clicking the return emoji, point β‘’, navigates back to the reference point.

Putting exactly the same code in a Wiki Markdown file does this:

Wiki footnote not working
Figure 12.5 β€” The same footnote in a Wiki Markdown file

Here, the footnote formatting is ignored and the entries appear as literal text.

I don’t know why footnotes work in repository Markdown files, but not in Wiki Markdown files, there doesn’t seem to be any explanations online either.

So what to do?

I want to use footnotes; they lend themselves to my style of writing. So I came up with my own version. It uses HTML anchor points, links and the note alert.

My version of the above footnote looks like this:

πŸ”½πŸ”½πŸ”½πŸ”½πŸ”½πŸ”½

The LOX pump had to deliver fuel at the rate of 24,811 gallons per minute and the kerosene from the tankage to the combustion chamber at the rate of 15,741 gallons per minute.

Note

πŸ’ 1 It would have filled a swimming pool twenty-five feet long, ten wide and six deep in twenty-seven seconds.↩

πŸ”ΌπŸ”ΌπŸ”ΌπŸ”ΌπŸ”ΌπŸ”Ό

Breaking it down it looks like this:

PS footnote
Figure 12.6 β€” PracticalSeries footnote in a Wiki Markdown file

This has a footnote reference (albeit with a diamond instead of the brackets), point β‘  above. The footnote itself, point β‘‘, is a note type alert (see section 8.6); this contains the footnote reference, point β‘’ and a return link, point β‘£, clicking either of these links back to the original footnote reference.

So how does it work?

This is the code behind it

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ πŸ”½

The LOX pump had to deliver fuel at the rate of 24,811 gallons per minute<a name="rn-01" href="#fn-01"><sup>πŸ’ 1</sup></a> 
and the kerosene from the tankage to the combustion chamber at the rate of 15,741 gallons per minute.


> [!NOTE]<!-- 🟑FOOTNOTE CONTENT -->
> <a name="fn-01" href="#rn-01"><sup>πŸ’ 1</sup></a>&emsp;It would have filled a swimming pool twenty-five feet long, 
ten wide and six deep in twenty-seven seconds.<a href="#rn-01">↩</a>

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ πŸ”½

The LOX pump had to deliver fuel at the rate of 24,811 gallons per minuteπŸ’ 1 and the kerosene from
the tankage to the combustion chamber at the rate of 15,741 gallons per minute.

[!NOTE] πŸ’ 1 It would have filled a swimming pool twenty-five feet long, ten wide and six deep in twenty-seven seconds.↩

Table 12.11 β€” A PracticalSeries footnote in a Wiki Markdown file

Examining the first bit, the footnote reference, it looks like this:

   <a name="rn-01" href="#fn-01"><sup>πŸ’ 1</sup></a>

And has the general format:

   <a name="returnID" href="#footnoteID"><sup>VisibleText</sup></a>

Firstly, returnID and footnoteID must be unique within the page (I use rn-xx for the returnID and fn-xx for the footnoteID, I keep the number xx the same for both and increment by 1 for each successive footnote on the page).

The name="returnID" sets the return point from the footnote text, the href="#footnoteID" is the link to the footnote text (see section 9.5 for full details of linking to anchor points). The VisibleText is simply what is displayed as the footnote link (in this case it is in superscript).

The footnote itself has to be positioned within the Markdown file. I tend to position them at the end of the page within which they occur.

The footnote itself is a Markdown note alert (see section 8.6 for full details), this displays the blue β„Ή in a circle and the note caption and puts a blue line down the left-hand side of the footnote (again see section 8.6).

The first part of the footnote shows the same VisibleText as the footnote reference above (a blue diamond with a number), this time the code is:

   <a name="fn-01" href="#rn-01"><sup>πŸ’ 1</sup></a>

And has the general format:

   <a name="footnoteID " href="#returnID "><sup>VisibleText</sup></a>

The, returnID and footnoteID must be match those used in the footnote reference.

The name="footnoteID" sets the anchor point from the footnote text (this is linked to in the footnote reference), the href="#returnID" is the return link to the footnote reference in the body text. The VisibleText is simply what is displayed as the footnote link (it is identical to the footnote reference).

This anchor link is followed by the text of the footnote which terminates with:

   <a href="#rn-01">↩</a>

And has the general format:

   <a href="#returnID "><sup>VisibleText</sup></a>

This is just a return link to the footnote reference in the body text, this time with a return emoji.




⚠️ **GitHub.com Fallback** ⚠️