How to publish on GOV.UK

Markdown

Using Markdown to format content in Whitehall publisher.

When you edit a document in Whitehall publisher you’ll also see a quick guide to Markdown under ‘Formatting’ on the right of the screen.

Acronyms

Adding acronym Markdown to a document means that when a user hovers over the acronym they see the full name as ‘alt text’.

You should:

  • add the acronym Markdown at the end of the body copy, leaving one empty line space above it
  • type an asterisk, square brackets around the acronym and a colon, then the full name, eg *[DWP]: Department for Work and Pensions
  • make sure there is no space between the asterisk and the square bracket

When you have more than one acronym, list:

  • each one on a new line
  • both plurals and singulars, but not possessives, eg DFT’s
  • plurals ahead of singulars, eg HGVs before HGV

See the style guide for how to use acronyms.

Addresses

For addresses use the Markdown $A above and below the address text.

Attachments

Use the Markdown for either ‘inline’ or ‘publication box’ attachments to position your attachments in the body text.

First you need to upload your attachments. The first attachment you upload is number 1, the second number 2, and so on. The number of an attachment doesn’t change, even if previous attachments are deleted.

Inline attachment

This will add the attachment title to a sentence or bullet point as hypertext. The file type and size shows in brackets after the title.

In the text, type [InlineAttachment:n]

Publication box

This is a more prominent link than the inline attachment. It shows the cover of the attached document, and adds the file type and size under the title. You should:

  • type !@1 for a publication box
  • leave a line space above and below the Markdown

For more information about attachments see the creating and editing content section.

Blockquotes

Blockquote Markdown should only be used for news stories and case studies. Don’t use blockquotes in speeches.

In news and case studies:

  • introduce the blockquote with a colon
  • leave one empty line space above and below your blockquote
  • add ‘>’ in any line spaces in the quote - if you leave it out you’ll get separate quotes on separate lines, not one running quote

For more advice on using blockquotes on GOV.UK, see the style guide.

Bullets

To create a bulleted list:

  • use asterisks (*) to make bullets (hyphens also work)
  • make sure there is one space after the asterisk
  • leave 1 empty line space before the bullets start, and one after

See the style guide to check how to punctuate bullets.

Call to action

Call to action Markdown should be used for short links to actions, like applying for a licence. It creates a tinted box which highlights the task.

To create the call to action box use the Markdown $CTA above and below the link.

Charts

Charts Markdown allows you to create ‘simple’, ‘stacked’ and ‘compact’ barcharts which can also display negative values. You can combine these within 1 chart.

The Markdown lets the user switch between a barchart and a table view on the webpage.

Simple barchart

You can show numeric data as a simple bar chart. Use grouped bars for multiple columns.

Stacked barchart

You can also create stacked bars. The final column is used to display the total.

Compact barchart

You can use a compact barchart to save space if you have a large graph.

Negative barchart

Use this if you have negative values in your bar chart.

Headings and sub-headings

In the document body, use 2 hashtags (##) for a section heading and 3 or 4 hashtags for sub-headings. These are called H2s, H3s and H4s.

Don’t use one hashtag, or you will get a title heading in the middle of your document.

Use the headings in sequence. An H3 needs to be preceded by an H2 and an H4 needs an H3.

There’s no need to use Markdown in the title and summary boxes. They are styled automatically.

The create a new document section has more about titles, summaries and sub-headings.

Images

To add images to a page:

  • first upload your image(s)
  • add the image Markdown !!n, where ‘n’ is the number of the image, in the text at the point(s) where you want the image to show on the webpage
  • leave an empty line space above and below the Markdown

To add internal links to GOV.UK pages, use square brackets [] around the link text and round brackets () around the link URL. Make sure there are no spaces between the brackets or the link won’t work.

Use the Whitehall publisher URL (like https://whitehall-admin.production.alphagov.co.uk/government/admin/publications/221540) when linking to any document made by the ‘create new document’ button (publications, consultations, speeches etc).

You should delete the first part of the URL and use the relative path: /government/admin/publications/221540.

Use ‘less than’ (<) and ‘greater than’ (>) arrows around email addresses to make them a link.

Linking to paragraphs

If you want to link to specific paragraphs within a document, you need to mark the paragraph as linkable by placing an anchor tag immediate below the paragraph:

{:#heading-name}

You can link to the paragraph from the same document:

[Paragraph link text](#links)

or from another document:

[Document link text](https://www.gov.uk/government/policies/managing-freshwater-fisheries#eel-decline)

Note: you have to use the full public URL when linking to a paragraph in another document. The admin URL won’t work.

The links section explains how to write and format links and includes the external linking policy.

Numbered list

  1. Use numbers followed by a full stop eg ‘1.’.

  2. Make sure there is one space after the full stop.

  3. You need 1 empty line space before the numbers start, and 1 at the end.

  4. Sub-items need an indent of 2 spaces.

See the style guide to check how to punctuate numbered lists.

Subscript and superscript

For subscript, surround the text to change with the < sub > < /sub > markdown.

This is an example of using subscript in text.

For superscript, surround the text to change with the < sup > < /sup > markdown.

This is an example of using superscript in text.

You should use subscript and superscript for scientific notation and measurements, eg chemical names, metres squared.

Tables

To make a table you need to:

  • leave one empty line space before the table starts and one at the end
  • use the Markdown for ‘dividers’ to split the content into cells, eg item 1 | item 2 | item 3
  • make sure every row has the same number of dividers
  • make a bold header row by using hyphens between the dividers in the second row, eg ----|----|----

You can’t use Markdown within a table. However, you can:

  • right align a column by putting a colon at the end of its cell in the second row, eg |---:|
  • use HTML to add links in your table, eg |<a href = “https://www.example.com”>This is a link in a cell</a>|
  • insert ‘break tags’ – <\br> – to split information into different lines within a cell

You can use a table generator to convert an Excel document, Google sheet or web-page table to Markdown.

Find out more information about using tables.

Video

You can embed videos directly into your page using Markdown. Only YouTube videos will work.

You should:

  • put the title of the video in square brackets and next to it in round brackets (no space) the URL of the YouTube page
  • leave a line space above and below your link

Don’t:

  • use the embed code or the ‘Share this video’ URL
  • use a bullet point

The video will display in an embedded media player automatically.

Markdown for manuals

There is some Markdown which is only to be used for the manual format.

Priority list

You can create a list which shows only the first n items (including attachments), with a link to open the others, eg to show the first item. This is the Markdown you’ll need to use:

$PriorityList:1
* item 1
* item 2
* item 3

Legislative list

This Markdown is for lists where you want to specify the numbering and have multiple indent levels:

  1. 1. Item 1
  2. 2. Item 2
    1. a) Item 2a
    2. b) Item 2b
      1. i. Item 2 b i
      2. ii. Item 2 b ii
  3. 3. Item 3

(to indent, add 2 spaces)

Footnotes

To include footnotes in your text you should:

  • add the footnote Markdown at the end of the line which the footnote refers to
  • leave 1 empty line space
  • add the same footnote Markdown on the line underneath with the corresponding footnote content
  • leave 1 empty line space before continuing the main text

The footnote content will always appear at the end of the document regardless of where they are in the Markdown.

Footnotes can be added using [^2] to create the footnote.

Use the Markdown followed by a colon to define the footnote: [^2]:

Footnote content can hold more than 1 paragraph by indenting the content 4 spaces.