Skip to content

11 Images

mgledhill edited this page Mar 14, 2025 · 8 revisions

PAL Logo showing Wiki Documentation heading

11SpacerImages

GitHub Markdown pages support the use of images, but do not support the use of video files (of any description) or audio files (of any description).

GitHub supports the following image file formats:

Image Type Meaning
GIF A very old and very limited image format (limited to 256 colours). GIFs are compressed, but lossless images
JPEG A compressed and lossy image format that give small image sizes. JPEGs do not support transparent backgrounds
BMP Another old image format. BMPs are uncompressed, lossless images that tend to be larger than other formats
PNG A compressed, but lossless image (intended as a replacement for BMPs and GIFs)
WEBP Similar to PNG but has better compression. It is a lossless format, but is not as well supported as the PNG format
SVG Scalar Vector Graphics. A vector graphic format that allows images to be scaled to any size without loss of resolution
Table 11.1 — Supported image format types

Do not use bmp or gif formatted images (bmp files are superseded by png and webp types, gifs are too limited).

SVGs tend to be for drawn or computer generated images (rather than photographs &c.).

The general rule for which image formats to use is:

Use SVG where possible
Use JPEGs for large images such as photographs
Use PNGs or WEBPs for everything else
List 11.1 — Rules for image files

GitHub Markdown can be used to directly display images, but as with tables, HTML images have more flexibility (can be resized &c.) and you can do more with them.

GitHub Markdown also supports some built in mechanisms for creating diagrams and models:

❶ Mermaid diagrams A Markdown mechanism for producing various kinds of flow charts and organisational diagrams
❷ GeoJSON An interactive map for showing geographic points and areas
❸ TopoJSON An extended version of GeoJSON that is very difficult to understand
❹ ASCII STL Used to create interactive 3D models
List 11.2 — Built in diagrams

All of these are covered in the following sections.

⬆️ Top



11.1SpacerMarkdown images

It is fairly easy to insert an image directly into a Markdown page, it’s a bit like a link.

The Markdown to insert an image is:

     ${\LARGE \color{#0050C0}\text{![}\color{#C00000}\text{Alternative\ Text}\color{#0050C0}\text{](}\color{#1F883D}\text{PathToImage}\color{#0050C0}\text{\ "}\color{#ED7D31}\text{ImageTitle}\color{#0050C0}\text{")}}$

The ${\large \color{#ED7D31}\text{ImageTitle}}$ is optional, it is displayed if the mouse hovers over the image (like a tooltip in links).

The ${\large \color{#C00000}\text{Alternative\ Text}}$ is only displayed if the image file cannot be found (it is also used by specialist screen readers, it’s bad form not to include it).

The following is the Markdown to display the image of Henry (first seen in section 9.6.2):

Markdown
${\large \color{#0050C0}\text{M\ A\ R\ K\ D\ O\ W\ N}}$ 🔽

![Henry the dog](./11-0000/02-images/figm-99-01.png "Henry")

Table 11.2 — Markdown image

Henry the dog

If for whatever reason, the image file cannot be found (missing file, incorrect path &c.), GitHub will display the alternative text as follows:

Broken link
Figure 11.1 — Markdown image broken link

It shows a broken image icon followed by the alternative text.

⬆️ Top



11.1.1SpacerImage size in Markdown

Image sizes when displayed using direct Markdown, are either always the full width of the screen area (i.e. full width of the main body text area, or if displayed in a footer or sidebar, the full width of those areas), or, the natural width of the image, whichever is smaller. The following shows an image as it would appear in the sidebar:

Image in a sidebar
Figure 11.2 — Image in a sidebar

It is only possible to change the image width by using HTML.

⬆️ Top



11.1.2SpacerMaking the image a link

It is possible in Markdown to make an image a clickable link (i.e. if you click the link it takes you to another page or website).

To make the image a link, surround it with brackets and then in parenthesis add the URL for the link (and any tooltip title):

     ${\LARGE \color{#0050C0}\text{[![}\color{#C00000}\text{Alternative\ Text}\color{#0050C0}\text{](}\color{#1F883D}\text{PathToImage}\color{#0050C0}\text{\ "}\color{#ED7D31}\text{ImageTitle}\color{#0050C0}\text{")](}\color{#1F883D}\text{LinkURL}\color{#0050C0}\text{\ "}\color{#ED7D31}\text{LinkToolTip}\color{#0050C0}\text{")}}$

To make the Henry picture a link to the PracticalSeries home page it would become:

Markdown
${\large \color{#0050C0}\text{M\ A\ R\ K\ D\ O\ W\ N}}$ 🔽

[![Henry the dog](./11-0000/02-images/figm-99-01.png "Henry")](https://practicalseries.com "PracticalSeries")

Table 11.3 — Markdown image

If two tooltips are used, one for the image (${\large \color{#ED7D31}\text{ImageTitle}}$) and one for the link (${\large \color{#ED7D31}\text{LinkToolTip}}$), the image takes priority.

⬆️ Top



11.1.3SpacerDrag and drop image link

When constructing a page using the GitHub editor (via a browser), it is possible to drag and drop an image from your computer directly into the edit window.

In GitHub select the page you want to put the image in and select ${\large \color{#00B050}\langle\text{edit}\rangle}$, top-right.

Now using Windows file explorer navigate to the image you wish to put on the Wiki page and drag it from explorer into the edit window where you want it to appear:

Drag and drop an image
Figure 11.3 — Drag and drop an image into a Wiki page

When you release the mouse, the link will be automatically created, it’s a bit odd:

Image created by GitHub
Figure 11.3 — Drag and drop image created by GitHub

GitHub has done something funny with the image, look at the Markdown:

Markdown
${\large \color{#0050C0}\text{M\ A\ R\ K\ D\ O\ W\ N}}$ 🔽

![fig 99-01](https://github.com/user-attachments/assets/32917acd-01c0-4e79-a81d-8a392a696407)

The ${\LARGE \color{#C00000}\text{Alternative\ Text}}$ is just the file name (without extension) of the file dragged into the edit window.

The link:

   https://github.com/user-attachments/assets/32917acd-01c0-4e79-a81d-8a392a696407

is something that GitHub has generated, it has taken the image that was dragged into the edit window and stored it on its own server at the address:

   https://github.com/user-attachments/assets/

Next, it’s given the image its own unique identifier:

   32917acd-01c0-4e79-a81d-8a392a696407

If you paste the link above into a browser, you will get the picture of Henry:

Uploaded image
Figure 11.5 — The uploaded image

The unique identifier is, I think, some form of SHA key, just like a commit.

This is all fine, but it is also peculiar; GitHub has uploaded the image that was dropped into the file, but instead of storing it in the Wiki repository (or even the main repository), it has stored it in a directory that has nothing to do with the Wiki, the repository or even the user.

GitHub has stored the image in a directory of its own that neither you, nor I, nor anyone else has control over (except presumably GitHub).

It also means that anyone who uploads an image to GitHub has their image stored in the same directory, but with a different identifier. They’re all in the same place.

I don’t particularly have a problem with this, except: how do you ever delete the image if you don’t want it anymore?

If I delete the image link from the Wiki page and resave the page, the link above still works, the image is still in that https://github.com/user-attachments/assets/ directory.

${\large \color{#B00000}\text{It’s\ odd.}}$

⬆️ Top



A note by the Author     

I said above that I don’t have a problem with this arrangement, but the more I think about it, the more I do have a problem, several in fact:

If I can’t delete any image, how do I control it?
Who has access to the image?
What is the copyright status of the image? I mean that’s a pretty cute picture of Henry, I’m sure some marketing person would like it.
Does the link ever expire?
List 11.3 — Problems with the drag and drop image

I’ve done a bit of digging and I can sort of answer some of these questions:

Point ❶: The only way to delete the image is to delete the repository, GitHub will then remove the “assets” associated with the repository (including the Wiki files) as part of its cleanup process. It will however, take quite some time to do this (it is not instantaneous, think weeks rather than hours).

Point ❷: Anyone who knows the link has access to the file.

Point ❸: Technically, the image is available under the licence terms of the repository (I suppose), however, if all you have is the link, there is no way to identify the parent repository and see what the licence terms are. So the long and short of it is: I don’t know.

Point ❹: The link only expires if the associated repository is deleted (or possibly if some sort of abuse is reported).

Talking of abuse, it strikes me that this whole drag and drop thing can be abused. GitHub imposes size limits on a repository (5 GB and preferably less than 1 GB) and on individual files (50 MB). It does not, however, impose size limits on files that can be dragged and dropped in this fashion.

Similarly, GitHub does not particularly care what type of files are dragged and dropped. If you drag and drop a Word file, it just uploads the file, creates a link to it and stores it in the https://github.com/user-attachments/ area.

Note

Some files (zip, docx, pdf &c.) are stored in a slightly different area: https://github.com/user-attachments/files/ (files instead of assets). I’m not sure what differentiates the file types.

So, if I were of a mischievous nature, what would be to stop me loading huge document files into this area by dragging and dropping them into a Markdown file, I would get around the size limits imposed on a repository and on individual files.

A question for GitHub perhaps?

⬆️ Top



11.2SpacerHTML images

Like tables, HTML offers a lot more formatting options when used for images.

It is fair to say that HTML is the mechanism of choice when displaying images within Markdown pages.

11.2.1SpacerA basic HTML image

Within HTML, images are defined with the <img> element (this tag has no closing </img>). It is in this form:

     ${\LARGE \color{#0050C0}\text{&lt;img src="}\color{#1F883D}\text{PathToImage}\color{#0050C0}\text{"\ alt="}\color{#C00000}\text{Alternative\ Text}\color{#0050C0}\text{"\ title="}\color{#ED7D31}\text{ImageTitle}\color{#0050C0}\text{"&gt;}}$

The ${\LARGE \color{#0050C0}\text{title="}\color{#ED7D31}\text{ImageTitle}\color{#0050C0}\text{"}}$ is optional, it is displayed if the mouse hovers over the image (like a tooltip in links).

As before, the ${\LARGE \color{#C00000}\text{Alternative\ Text}}$ is only displayed if the image file cannot be found. The following is the HTML to display the image of Henry (lots more pictures of Henry):

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ 🔽

<img src="./11-0000/02-images/figm-99-01.png" alt="Henry the dog" title="Henry">

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ 🔽
Henry the dog
Table 11.4 — HTML for a basic image

If for whatever reason, the image file cannot be found (missing file, incorrect path &c.), GitHub will display the alternative text as follows:

HTML Broken link
Figure 11.6 — HTML Broken link

It shows a broken image icon followed by the alternative text (just like Markdown).

⬆️ Top



11.2.2SpacerImage size in HTML

HTML allows images to be resized (in pixels) using the ${\large \color{#00B050}\text{width}}$ or ${\large \color{#00B050}\text{height}}$ attributes (similar to cells in a table, see section 10.2.4 and section 10.2.5).

The following reduces the Henry image to 300 px wide:

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ 🔽

<img width="300" src="./11-0000/02-images/figm-99-01.png" alt="Henry the dog" title="Henry">

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ 🔽
Henry the dog
Table 11.5 — Resized width image

The height attribute is used in the same way, the following sets the image height to 300 px:

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ 🔽

<img height="300" src="./11-0000/02-images/figm-99-01.png" alt="Henry the dog" title="Henry">

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ 🔽
Henry the dog
Table 11.6 — Resized height image

If both the width and height attributes are used, the image can be distorted (this sets the width to 300 pixels and height to 200 pixels):

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ 🔽

<img width="300" height="200" src="./11-0000/02-images/figm-99-01.png" alt="Henry the dog" title="Henry">

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ 🔽
Henry the dog
Table 11.7 — Resized width and height image

Poor old Henry.

In all cases the image is left-aligned on the screen.

Note

If the width is set to a value that exceeds the width of the screen, the width will be limited to the width of the screen.

⬆️ Top



11.2.3SpacerHorizontal alignment

Like tables, HTML images can be left or right aligned on a page by using the ${\large \color{#00B050}\text{align}}$ attribute (note there is no centre alignment).

Left alignment first:

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ 🔽

<img align="left" width="300" src="./11-0000/02-images/figm-99-01.png" alt="Henry the dog" title="Henry">

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur tortor 
a tortor ornare, non pretium diam faucibus. Morbi ut mollis.</p>

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ 🔽
Henry the dog

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur tortor a tortor ornare, non pretium diam faucibus. Morbi ut mollis.

Table 11.8 — left aligned image

Now right alignment

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ 🔽

<img align="right" width="300" src="./11-0000/02-images/figm-99-01.png" alt="Henry the dog" title="Henry">

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur tortor 
a tortor ornare, non pretium diam faucibus. Morbi ut mollis.</p>

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ 🔽
Henry the dog

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur tortor a tortor ornare, non pretium diam faucibus. Morbi ut mollis.

Table 11.8 — right aligned image

Note

If the align attribute is not used, the text will not wrap, it will appear below the image.

This leads to the text wrapping problem we came across with tables (see section 10.2.3). With images we have an additional option to solve the problem.

The first solution is to use the ${\LARGE \color{#C00000}\text{&lt;br\ clear="all"&gt;}}$ tag after the image (this is just like the solution for tables see here):

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ 🔽

<img align="right" width="300" src="./11-0000/02-images/figm-99-01.png" alt="Henry the dog" title="Henry">
<br clear="all">

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur tortor 
a tortor ornare, non pretium diam faucibus. Morbi ut mollis.</p>

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ 🔽
Henry the dog

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur tortor a tortor ornare, non pretium diam faucibus. Morbi ut mollis.

Table 11.10 — Right aligned image without text wrap

HTML also offers another solution, instead of using the align attribute within the image tag, surround the image tag with a <p> paragraph tag and use the align attribute within the paragraph tag instead:

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ 🔽

<p align="right"> <img width="300" src="./11-0000/02-images/figm-99-01.png" alt="Henry the dog" title="Henry">
<br clear="all"></p>

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur tortor 
a tortor ornare, non pretium diam faucibus. Morbi ut mollis.</p>

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ 🔽

Henry the dog

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur tortor a tortor ornare, non pretium diam faucibus. Morbi ut mollis.

Table 11.11 — Right aligned image using paragraphs

The difference here is that using the paragraph arrangement, there is proper line spacing between the image and the following paragraph.

Note

This paragraph arrangement does not work for tables (surrounding a table with a paragraph does nothing to the table).

The paragraph arrangement allows the image to be centred (which is not possible when using the align attribute directly with the <img> tag):

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ 🔽

<p align="center"> <img width="300" src="./11-0000/02-images/figm-99-01.png" alt="Henry the dog" title="Henry">
<br clear="all"></p>

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur tortor 
a tortor ornare, non pretium diam faucibus. Morbi ut mollis.</p>

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ 🔽

Henry the dog

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In consectetur tortor a tortor ornare, non pretium diam faucibus. Morbi ut mollis.

Table 11.12 — Centre aligned image using paragraphs

There is a third option for controlling image alignment and that is to use a table, this is discussed in section 11.2.5 and section 16.5.4.

⬆️ Top



11.2.4SpacerMaking the image a link

As with Markdown, it is possible to make an image a clickable link (i.e. if you click the link it takes you to another page or website) in HTML too.

To make the image a link, use the anchor <a> tag around the image:

HTML
${\large \color{#00C050}\text{H\ T\ M\ L}}$ 🔽

<a href="LinkURL" title="ImageTitle"><img src="PathToImage" alt="Alternative Text" title="ImageTitle"></a>

Table 11.13 — Image with a link

To make the Henry picture a link to the PracticalSeries home page it would become:

HTML
${\large \color{#00C050}\text{H\ T\ M\ L}}$ 🔽

<a href="https://practicalseries.com" title="PracticalSeries"><img src="./11-0000/02-images/figm-99-01.png" alt="Henry"></a>

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ 🔽

Henry

Table 11.14 — Henry with a link

If both the image and the link have a ${\large \color{#00B050}\text{title}}$ attribute, the image title will take preference.

The ${\large \color{#00B050}\text{width}}$ and ${\large \color{#00B050}\text{align}}$ attributes can still be used with the <img> tag in this format.

Note

The align attribute does not work with the anchor tag <a>.

⬆️ Top



11.2.5SpacerUsing a table to contain an image

This I think give a much more professional look to an image; this is also the PracticalSeries mechanism for displaying an image.

It looks like this:

Table with an image
Figure 11.7 — Table used to hold an image and caption

The use of a table to surround the image gives the image a grey border (1 px wide) and allows for a figure number and caption to be given below the image (in the next row of the table), this caption is shaded (the shading of the caption is accidental, the second row of a table is always shaded).

The HTML behind this is:

HTML (numbered))
Line no. ${\large \color{#00C050}\text{H\ T\ M\ L}}$ 🔽
1
2
3
4
5
6
<table name="f-11-07" align="center"><!-- Leave blank line above --- IMAGE TABLE START -->
  <tr><td>
<img width="400" src="./11-0000/02-images/figm-99-01.png" alt="Henry">
  </td></tr>
  <tr><th align="center"><sup>Figure 11.7 &mdash; Henry the dog</sup></th></tr><!-- CAPTION -->
</table>                             <!-- Leave blank line below --- IMAGE TABLE END-->
Table 11.15 — Image in a table

This is a table with two rows, each with a single cell.

The table is defined in line 1 to be ${\large \color{#00B050}\text{align="center"}}$, i.e. it appears in the centre of the main body text area. The table is also given a name (${\large \color{#00B050}\text{name="f-11-07"}}$), in this case the name is ${\large \color{#00B050}\text{f-11-07}}$ indicating figure 11.7 (this is the convention used in the PracticalSeries Wikis, you can use any name you like as long as it is unique within the Wiki page).

Line 2 defines the first row and its data cell.

Line 3 is the image, this is exactly as described previously, there is no alignment, it will fill the cell to which it is assigned (the alignment is handled at the table level in line 1).

Line 4 is the end of the first cell and its row.

Line 5 defines the second row and its data cell, in this case the text within the cell is centre aligned (${\large \color{#00B050}\text{align="center"}}$). The caption text (Figure 11.7 &mdash; Henry) is the text that will appear in the row below the image, the &mdash; is an em dash (—) that separates the figure number from the figure description.

The <sup>…</sup> puts the caption text as a superscript (see section 6.9), it raises the text and makes it smaller, this is just to make the text look more like a caption than body text.

Line 6 is simply the closing table tag to finish the whole thing off.

Note

If both the image and the table cell have widths specified, whichever is larger has priority.

There is one final point, with the image in a table, it is possible to put a dark border around the whole table by using the border attribute discussed in section 10.2.9. To do this, change the first line to:

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ 🔽

<table name="f-11-07" align="center" border="1"><!-- Leave blank line above --- IMAGE TABLE START -->
  <tr><td>
<img width="400" src="./11-0000/02-images/figm-99-01.png" alt="Henry">
  </td></tr>
  <tr><th align="center"><sup>Figure 11.7 &mdash; Henry the dog</sup></th></tr><!-- CAPTION -->
</table>                             <!-- Leave blank line below --- IMAGE TABLE END-->

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ 🔽
Henry
Figure 11.7 — Henry the dog
Table 11.16 — Image in a table with border

⬆️ Top



11.3SpacerForcing an image refresh

This is another oddball thing that crops up from time-to-time. It isn’t so much a GitHub thing as a browser thing.

When a link to an image is created on a Markdown page (either using Markdown or HTML) and that page is then viewed in a browser, the browser buffers all the images on the page and stores them in a cache on the local machine. It does this so that if the page is viewed again, it doesn’t have to reload the images and the page displays more quickly.

After a while, the browser will discard these images and reload them💠1. This isn’t generally a problem, images on websites don’t change that frequently. It can however be a problem for us with a Wiki, particularly when it is the image that is being edited. If we change an image, we don’t really want to wait several minutes for the browser to refresh the image before we can see the changes.

If an image is changed in a GitHub Wiki, but its filename remains the same, the browser can’t tell the image in its cache is different to the image on the website (it doesn’t check anything other than the filename) and the cached image will be used by default (until such time as the browser refreshes the image).

It is possible to force a browser to do a hard refresh of a page (Edge uses ${\large \color{#00B050}\text{ctrl+F5}}$ to force a hard refresh), this reloads all the content of a page and ignores any cached images.

It is possible to add a “query” to an image link, this is a question mark followed by some text in the form:

     ${\LARGE \color{#C00000}\text{?}\color{#1F883D}\text{AnyText1}\color{#0050C0}\text{=}\color{#ED7D31}\text{AnyText2}}$

${\LARGE \color{#1F883D}\text{AnyText1}}$ and ${\LARGE \color{#ED7D31}\text{AnyText2}}$ can be anything at all, they have no meaning. A query is simply a string of characters following a question mark that are supplied to the browser and forwarded to the host website (it’s how Google does searches), if the host website isn’t expecting a query, it is simply ignored

In the context of the previous example it might look like this:

Markdown and HTML
${\large \color{#0050C0}\text{M\ A\ R\ K\ D\ O\ W\ N}}$ 🔽

![Henry the dog](./11-0000/02-images/figm-99-01.png?b=01)

${\large \color{#00C050}\text{H\ T\ M\ L}}$ 🔽

img src="./11-0000/02-images/figm-99-01.png?b=01">

By adding the ?b=01 we have created a query that does absolutely nothing, the image will appear just as it did and no additional text will be displayed. The browser will cache the image and everything will be as it was before.

If the image is modified and its name left the same, the browser will still display the old cached image in place of the change image (it knows no different).

If, however, we now change the query (let’s say to ?b=02), the browser now sees a different link (the query is part of the link as far as the browser is concerned) and it reloads the image into its cache.

Changing the query reloads the image.

For PracticalSeries images, I use the query ?bxno=HHMM where bxno simply means build number and HHMM is the time (hours and minutes) when I pushed the change to GitHub (this is usually enough to force a refresh).

⬆️ Top



11.4SpacerUsing a spacer image

It is possible to use an image to force a space of a given number of pixels.

The following is a 1 px by 1 px transparent png file (it contains nothing, but a transparent image that is 1 pixel wide by one pixel tall), you can download it here:

   https://github.com/practicalseries/GitHub-Wiki-Design-and-Implementation/wiki/00-0000/02-images/wi-spacer.png

It is called:

   wi-spacer.png

By inserting this image and setting its ${\large \color{#00B050}\text{width}}$ to a specific value, a space can be created between Markdown elements:

HTML and GitHub output
${\large \color{#00C050}\text{H\ T\ M\ L}}$ 🔽

Start<img width="300" height="1" src="00-0000/02-images/wi-spacer.png" alt="spacer">End

${\large \color{#B00000}\text{G\ I\ T\ H\ U\ B}\space\ \space\text{O\ U\ T\ P\ U\ T}}$ 🔽

StartspacerEnd

Table 11.17 — Using a spacer image

There is exactly 300 px between the last "t" of the word "start" and the "e" of the word "end".

When setting the ${\large \color{#00B050}\text{width}}$ to the required value, it is important the ${\large \color{#00B050}\text{height}}$ is always set to 1. If no height is specified, increasing the width will also increase the height in the same proportion (in this case, the height would become 300 px too) and this will lead to large gaps above the spaced text.

Note

Such spacings can be used in headings and tables of contents as an alternative to using special space characters (the is the approach taken with PracticalSeries Wikis) see section 16.5.2.

⬆️ Top


Footnotes:     


Note

💠1 The actual time is set by the website (in this case GitHub) and is referred to as the "time-to-live" (live to rhyme with spiv not live to rhyme with thrive), it is sometimes called the TTL setting, this is how long an image will remain cached in a browser before being refreshed.

For GitHub this is set to 937 seconds (15 minutes, 37 seconds). To find the TTL setting for any website (on a Windows computer) open a com-mand prompt and type:

nslookup -type=A -debug www.example.com

Always use www. before the domain name (Windows requires it).




Wiki contentsSpacer

Previous page Previous chapter Home Next chapter Next page
   Home

       The GitHub Wiki
       What does this guide cover?
       A note by the Author

     CaseNotes

   Licence

       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: licence or license

1    Introducing the GitHub Wiki

   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
   1.3.2     Creating additional pages
   1.3.3     Editing a Wiki page
   1.4      The Wiki is its own repository
   1.4.1     Viewing a Wiki page history
   1.4.2     How GitHub handles Wiki branche
   1.4.3     The Wiki link to the main repository
   1.5      Basic components of a Wiki page
   1.5.1     Title bar and revision
   1.5.2     Contents (pages) area
       Listing pages in the order you want
   1.5.3     Sidebars
   1.5.4     Footers
   1.6      Sidebars and footers
   1.6.1     Creating a sidebar and footer

2    Cloning a Wiki

   2.1      Why clone a Wiki?
   2.2      How to clone a Wiki
   2.3      Pushing local changes to GitHub
   2.3.1     Configuring username and email
   2.3.2     Modifying the local repository
   2.3.3     Committing and synchronising

3    A Wiki folder structure

   3.1      The default arrangement
   3.2      Create a sidebar or footer locally
   3.3      Page naming and Wiki limits
   3.3.1     Supported file types
   3.3.2     Page names and numbering
   3.3.3     Rules for page numbering
   3.3.4     Limits for Wiki pages
   3.4      A Practical Wiki folder structure
   3.4.1     Subfolder names for Wiki pages
   3.4.2     Storing images and other data

4    Different sidebars and footers

   4.1      How sidebars work
   4.1.1     The PracticalSeries sidebar
   4.2      How footers work
   4.2.1     The PracticalSeries footer

5    Markdown, GitHub Markdown and HTML

   5.1      Some useful Markdown sites
   5.2      An overview of Markdown
   5.3      How Markdown works
   5.4      Markdown flavours
   5.4.1     GitHub Flavoured Markdown (GFM)
   5.5      HTML and Markdown
   5.5.1     HTML with GFM
       GFM blacklisted HTML tags
       GFM whitelisted HTML tags
       GFM HTML tags - the grey area
       GFM whitelisted HTML attributes
   5.5.2     PracticalSeries and Markdown
   5.6      Markdown difference between files

6    Basic Markdown and text formatting

   6.1      Body text and fonts
   6.1.1     Body text responsive design
   6.1.2     Body text in sidebars and footers
   6.1.3     Rules for body text
   6.1.4     Body text examples
   6.1.5     Alignment of Body text
       Left aligned text (default)
       Right aligned text
       Centred text
       Justified text
   6.1.6     Body text propertie
   6.2      Paragraphs and line breaks
   6.2.1     Forced line break
   6.2.2     Blank line and a line break
   6.2.3     Trailing space line break
   6.2.4     Paragraph and line break rules
   6.2.5     Paragraph and line break examples
   6.3      Horizontal line
   6.3.1     Rules for horizontal lines
   6.4      Emphasis with bold
   6.4.1     Rules for bold
   6.4.2     Bold text examples
   6.5      Emphasis with italics
   6.5.1     Rules for italics
   6.5.2     Italic text examples
   6.6      Emphasis with bold and italics
   6.6.1     Rules for bold and italics
   6.6.2     Bold and italic text examples
   6.7      Emphasis with underlining
   6.7.1     Rules for underlining
   6.7.2     Underlining text examples
   6.8      Emphasis with strikethrough
   6.8.1     Rules for strikethrough
   6.8.2     Strikethrough text examples
   6.9      Superscript and subscript
   6.9.1     Rules for superscript and subscript
   6.9.2     Superscript and subscript examples
   6.10    Headings
       Alternatives for heading 1 and 2
   6.10.1   Headings Markdown rules
   6.10.2   Heading properties

7    Special characters and escaping characters

   7.1      Escape characters and codes
   7.1.1     Markdown escape sequences
   7.1.2     HTML escape sequences
   7.1.3     Decimal and hexadecimal codes
       Hexadecimal escape codes
   7.2      Special space characters
   7.2.1     Escape sequence restrictions
   7.3      Emojis and emoticons
       A note by the Author about emojis
   7.4      Comments

8    Block quotes, lists and alerts

   8.1      Block quotes
   8.1.1     Nested block quotes
   8.1.2     Adding other elements
   8.1.3     Rules for block quotes
   8.2      Unordered (unnumbered) lists
   8.2.1     Nested unordered lists
   8.2.2     Type of bullet point
   8.2.3     Indents and spacing
   8.2.4     Numbers in an unordered list
   8.2.5     Adding paragraphs
   8.2.6     Adding other elements
   8.2.7     Rules for unordered lists
   8.3      Ordered (numbered) lists
   8.3.1     Starting at a different number
   8.3.2     Nested ordered lists
   8.3.3     Type of numbering
   8.3.4     Indents and spacing
   8.3.5     Adding paragraphs
   8.3.6     Adding other elements
   8.3.7     Rules for ordered lists
   8.4      Mixing ordered and unordered lists
   8.5      Task lists (check boxes)
   8.5.1     Nested task lists
   8.6      Alerts
   8.6.1     Rules for alerts

9    Links

   9.1      Link to an external web page
   9.1.1     A direct link to a URL
   9.1.2     A link using substitute text
   9.1.3     A link using tooltips
   9.2      Link to another page in the Wiki
   9.2.1     Rules for linking to a Wiki page
   9.3      Link to headings on current page
   9.3.1     Converting a heading to a link
   9.3.2     An example of a heading link
   9.3.3     Heading link with tooltips
   9.4      Link to headings on a different page
   9.4.1     An example of a heading link
   9.5      Link to a named element
       A note by the Author
   9.5.1     Link to a point on another page
   9.6      Downloading a file
   9.6.1     The download attribute
   9.6.2     Spaces in filenames
   9.6.3     Downloading a .md file
   9.7      Reference style links
   9.8      Relative links
   9.8.1     Relative links from any Wiki page

10  Tables

   10.1    Markdown tables
   10.1.1   Horizontal alignment
   10.1.2   Table construction
   10.1.3   Vertical line breaks and alignment
   10.1.4   Making columns wider
   10.1.5   Other elements in a table
   10.1.6   Markdown table restrictions
   10.2    HTML tables
   10.2.1   A basic HTML table
   10.2.2   Aligning a table on a page
   10.2.3   Text wrap and side-by-side tables
       What this means in practice
       The problem with the align attribute
       How to stop text wrapping
   10.2.4   Setting the width of a table column
   10.2.5   Setting the height of a table row
   10.2.6   Horizontal alignment
   10.2.7   Vertical alignment
   10.2.8   Spanning columns and rows
   10.2.9   Table border
   10.2.10   Giving a table a navigable name
   10.2.11   Additional HTML tags

11  Images

   11.1    Markdown images
   11.1.1   Image size in Markdown
   11.1.2   Making the image a link
   11.1.3   Drag and drop image link
       A note by the Author
   11.2    HTML images
   11.2.1   A basic HTML image
   11.2.2   Image size in HTML
   11.2.3   Horizontal alignment
   11.2.4   Making the image a link
   11.2.5   Using a table to contain an image
   11.3    Forcing an image refresh
   11.4    Using a spacer image
   11.5    Mermaid diagrams
   11.5.1   Inserting a Mermaid diagram
   11.5.2   The rendered Mermaid diagram
   11.5.3   Supported version of Mermaid
   11.6    Interactive maps
   11.7    3D models

12  Contents (collapsible) and footnotes

   12.1    A basic table of contents
   12.2    Understanding the space characters
   12.3    Collapsible content
   12.3.1   Defaulting to open
   12.3.2   Markdown restrictions
   12.4    Collapsible TOC
   12.5    TOCs in tables
   12.6    Footnotes

13  Code fragments

   13.1    Inline code
   13.2    Code blocks
   13.2.1   Preferred mechanism
   13.3    Syntax highlighting
   13.3.1   Supported languages
   13.4    HTML code fragments
   13.4.1   Converting HTML to code

14  Mathematical formulae

   14.1    An overview of LaTex
   14.2    Inserting an inline formula
   14.2.1   Alternative delimiter
   14.3    A formula block
   14.4    Some example formulae
   14.5    LaTeX syntax
   14.5.1   Greek lowercase
   14.5.2   Greek uppercase and Hebrew
   14.5.3   Mathematical constructions
   14.5.4   Variable sized delimiters
   14.5.5   Variable sized symbols
   14.5.6   Variable sized symbols with limits
   14.5.7   Standard functions
   14.5.8   Operators and relational symbols
   14.5.9   Arrows
   14.5.10   Other symbols
   14.5.11   Accents
   14.5.12   Matrices
   14.5.13   Cases
       Aligning multiple equations
   14.5.14   Text formatting
       Font size
       Font colour
       The text command
       Font restrictions
   14.6    Abusing LaTeX
   14.6.1   Changing font colour with LaTeX

15  Navigation bars, badges and buttons

   15.1    Navigation bars
   15.1.1   Navigation bar practicalities
   15.2    Badges
   15.2.1   Creating a badge
   15.2.2   Static badge options
   15.2.3   Dynamic badges
   15.3    Buttons

16  PracticalSeries Wiki conventions

   16.1    The PracticalSeries Wiki page
   16.2    The PracticalSeries folder structure
   16.2.1   The root folder and home page
   16.2.2   Leading pages
   16.2.3   .gitkeep files
   16.2.4   Folder and Markdown file names
       Wiki pages that start at a section
   16.3    The page title area
   16.4    The page heading area
   16.4.1   Top of page marker
   16.4.2   Logo image
   16.4.3   Web ID badge
   16.5    Main body area
   16.5.1   Common page elements
       End of page marker
       End of section elements
   16.5.2   Headings
       Compensating for number widths
       Appendices headings
   16.5.3   Tables
       Links to a table
       A note on Markdown tables
   16.5.4   Images
       Images that open in a new tab
       Double images
       Links to a figure
   16.5.5   Lists
       Common points for all lists
       Basic unordered list
       Basic ordered list
       Mixed ordered and unordered lists
       Enhanced mixed lists
       Index list
       Reverse index list
       Index list with text wrap
       Reverse index list with text wrap
       Indexed, mixed list
       Reverse indexed, mixed list
       Task list
       Enhanced task list with observations
   16.5.6   Code fragments
   16.5.7   Formulae
       Standard formulae
       Alternate formulae
   16.6    Sidebar
   16.6.1   sidebar files and locations
   16.6.2   Sidebar title and location badge
   16.6.3   Navigation bar
   16.6.4   Table of contents
       Unnumbered, non-collapsible TOC
       Unnumbered, collapsible TOC
       Single digit, collapsible TOC
       Double digit, collapsible TOC
       TOCs for appendices
   16.6.5   End of page link
   16.7    Footer
   16.7.1   Footer files and locations
   16.7.2   Location badge
   16.7.3   Navigation bar
   16.7.4   Colophon
   16.7.5   Links and contacts

17  Managing a Wiki

   17.1    Revision control
   17.1.1   Managing commits
   17.2    Finding the first Wiki commit
   17.3    Rebasing the Wiki
   17.3.1   Summarising the rebase process
   17.3.2   Executing the rebase process
   17.4    Wikis and search engine visibility


Appendices
A    Unicode and HTML escape

   A.1     HTML Escape codes, full list
   A.2     Non-functional escape sequences

B    Full list of all emoji characters

   B.1      Emojis, a brief explanation
   B.1.1     Emoji short names
   B.1.2     Emoji escape codes
   B.1.3     Emoji variations
   B.1.4     Emoji numbers
   B.2      Emojis characters by category
       Smileys and emotion
       People and body
       Component
       Animals and nature
       Food and drink
       Travel and places
       Activities
       Objects
       Symbols
       Flags
   B.3      Emoji characters by Unicode

C    Segoe UI full character set

       A note by the Author
   C.1     Inserting Unicode characters
   C.2     Characters U+00000 to U+00FFF
   C.3     Characters U+01000 to U+01FFF
   C.4     Characters U+02000 to U+02FFF
   C.5     Characters U+03000 to U+09FFF
   C.6     Characters U+0A000 to U+0AFFF
   C.7     Characters U+0B000 to U+0FFFF
   C.8     Characters U+10000 to U+10FFF
   C.9     Characters U+11000 to U+11FFF
   C.10   Characters U+12000 to U+12FFF
   C.11   Characters U+13000 to U+15FFF
   C.12   Characters U+16000 to U+1CFFF
   C.13   Characters U+1D000 to U+1EFFF
   C.14   Characters U+1F000 to U+3FFFF

D   3D Model of a Sierpinski cube

       3D Sierpinski cube

E    Template

       COMMENT FIELDS
       HEADINGS
       TABLES
       FIGURES
       LISTS
       TASK LISTS
       CODE FRAGMENT
       FORMULAE
       LINKS
       BUTTONS
       ALERTS
       COLOURED TEXT
       INDEX NUMBERS
       END OF SECTION
       FOOTNOTE
       END OF PAGE

⬇️ End of page
Clone this wiki locally