Skip to content

Commit 9b70171

Browse files
Add copy code examples to Markdown guide (#453)
This adds a 'Copy code' button to all of the code examples in the [Using Markdown guide](https://design-history.prevention-services.nhs.uk/guide/using-markdown/): <img width="753" height="686" alt="Screenshot 2026-04-08 at 16 37 42" src="https://github.com/user-attachments/assets/b5ec3ded-ab55-4070-bfe6-6bd84ddd2b45" />
1 parent 1e03cb7 commit 9b70171

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

app/guide/using-markdown.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Posts within this design history website are written using [Markdown](https://en
1414

1515
You don’t have to do anything special for paragraphs, except for making sure that there is an empty line between each one.
1616

17-
```md
17+
```md { .nhsuk-code--button }
1818
This is a paragraph.
1919

2020
This is another paragraph.
@@ -31,7 +31,7 @@ Do not include a post title (h1) as this will be generated automatically from th
3131

3232
You do not need to create a heading before the introductory paragraph.
3333

34-
```md
34+
```md { .nhsuk-code--button }
3535
This is an introductory paragraph.
3636

3737
## Heading
@@ -49,7 +49,7 @@ To create links, you have to use a combination of square brackets and round brac
4949

5050
The square brackets come first, and contain the link text. This must be immediately followed by round brackets which contain the URL.
5151

52-
```md
52+
```md { .nhsuk-code--button }
5353
For more information, see [vaccinations on the NHS website](https://www.nhs.uk/vaccinations/).
5454
```
5555

@@ -59,7 +59,7 @@ If you are linking to another post on this design history site, you should not i
5959

6060
This should start with a forward slash (`/`) character:
6161

62-
```md
62+
```md { .nhsuk-code--button }
6363
We previously wrote about [the pilot](/screening-invite/2025/06/invite-pilot-overview/).
6464
```
6565

@@ -71,7 +71,7 @@ To create a footnote reference, add a caret with an identifier inside brackets `
7171

7272
Add the footnote using another caret and number inside brackets with a colon and the associated text `[^1]: My footnote`. You don't have to put footnotes at the end of the markdown document -- that's where they will be rendered though. This can make it easier to add a footnote reference and a footnote close to each other.
7373

74-
```md
74+
```md { .nhsuk-code--button }
7575
Here's a simple footnote,[^1] and here's a longer one.[^bignote]
7676

7777
[^1]: This is the first footnote.
@@ -109,7 +109,7 @@ You can add bullet lists by starting each item of the list with a dash (`-`) cha
109109

110110
There should be a blank line before and after each list.
111111

112-
```md
112+
```md { .nhsuk-code--button }
113113
We have 3 user types:
114114

115115
- administrators
@@ -123,7 +123,7 @@ If the order of items in your list is significant, use a numbered list.
123123

124124
Each item in the list should start with a number, a full stop and then a space.
125125

126-
```md
126+
```md { .nhsuk-code--button }
127127
This was our design process:
128128

129129
1. Desk research
@@ -138,7 +138,7 @@ You can add quotations by starting each line of the quote using a greater than (
138138

139139
If you are quoting a user taking part in research, they should not be identifiable.
140140

141-
```md
141+
```md { .nhsuk-code--button }
142142
As the NHS vaccination strategy says:
143143

144144
> Vaccination services and activities should be holistic.
@@ -156,7 +156,7 @@ This is shown like this:
156156

157157
You can attribute a quote to its author by adding two hyphens (`--`) before the attribution you want to add.
158158

159-
```md
159+
```md { .nhsuk-code--button }
160160
> No society can legitimately call itself civilised if a sick person is denied aid because of lack of means.
161161
> -- Nye Bevan, 1952
162162
```
@@ -176,7 +176,7 @@ The alt text should contain the key information within the image that is being d
176176

177177
Within the round brackets you must include the exact name of the image file, which is case sensitive.
178178

179-
```md
179+
```md { .nhsuk-code--button }
180180
We redesigned the homepage to clearly list the different services within our portfolio:
181181

182182
![Screenshot of a website with the title 'Digital prevention design history'. Beneath this are 3 headings labelled 'Screening', 'Vaccinations' and 'Personalised prevention', and underneath these headings are linked service names in a two column grid.](homepage-redesign.png)
@@ -190,7 +190,7 @@ The caption is in addition to alt text. Unlike the alt text, the caption cab be
190190

191191
The caption is added inside the round brackets, after the file name, within double quotes (`"`).
192192

193-
```md
193+
```md { .nhsuk-code--button }
194194
This is our brand:
195195

196196
![Blue rectangle containing 'NHS' as white slanted letters](nhs-logo.png "The NHS logo")
@@ -208,7 +208,7 @@ To add tables, use the pipe (`|`) character to separate the columns and at the s
208208

209209
The table should start with a row that contains headings for each column. After this heading row, add a row using dash (`-`) characters in each column to separate the column headings from the table data.
210210

211-
```md
211+
```md { .nhsuk-code--button }
212212
These are the questions we included in the survey:
213213

214214
| Field | Format | Type |
@@ -225,7 +225,7 @@ Notes can be used emphasise important information or to highlight content that h
225225

226226
To add a note, start each line with a `>` character, and add `> [!NOTE]` on the line immediately above:
227227

228-
```markdown
228+
```markdown { .nhsuk-code--button }
229229
> [!NOTE]
230230
> In the UK, 1 in 5 people is disabled.
231231
>
@@ -241,7 +241,7 @@ This will display as:
241241
242242
You can also include a title:
243243

244-
```markdown
244+
```markdown { .nhsuk-code--button }
245245
> [!NOTE] Help take part in research
246246
> We’d like to spend 20 minutes talking to you about your experiences.
247247
```
@@ -255,7 +255,7 @@ The rendered output looks like this:
255255

256256
Alerts are rendered as [warning callouts](https://service-manual.nhs.uk/design-system/components/warning-callout):
257257

258-
```markdown
258+
```markdown { .nhsuk-code--button }
259259
> [!IMPORTANT]
260260
> This assumption has not yet been validated.
261261
```
@@ -267,7 +267,7 @@ This displays as:
267267
268268
If you include a title, this will be shown in the heading instead:
269269

270-
```markdown
270+
```markdown { .nhsuk-code--button }
271271
> [!IMPORTANT] Clinical note
272272
> This guidance was based on information in the Patient Group Direction (PGD).
273273
```

0 commit comments

Comments
 (0)