-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to Highlight.js syntax highlighting (#230)
This removes the existing syntax highlighting which uses Prism, which runs client-side, and swaps it for Highlight.js, which runs server-side. It copies across the colours and styling for both inline code examples and longer code blocks from the NHS Service manual (where they’ve been tweaked to ensure a good colour contrast). The longer code blocks use a new `codeSnippet` macro, which also takes a `language` parameter that is passed to Highlight.js and used for syntax highlighting. Resolves #21 ## Screenshots | Type | Before | After | |------|--------|-------| | HTML | <img width="670" alt="Screenshot 2025-02-20 at 10 18 59" src="https://github.com/user-attachments/assets/a7ccb439-bf9f-4080-b21d-9a6d82e88674" /> | <img width="682" alt="Screenshot 2025-02-20 at 10 21 10" src="https://github.com/user-attachments/assets/1b3f319a-98dd-4e8a-bd91-0033d4867107" /> | | JavaScript | <img width="667" alt="Screenshot 2025-02-20 at 10 17 49" src="https://github.com/user-attachments/assets/bdd23ec6-eb76-4371-b61e-5fa1d282a06b" /> | <img width="664" alt="Screenshot 2025-02-20 at 10 17 31" src="https://github.com/user-attachments/assets/a299c100-5b7d-43da-b4f3-3cbeed363acf" /> | | Nunjucks | <img width="678" alt="Screenshot 2025-02-20 at 10 16 12" src="https://github.com/user-attachments/assets/2fa2ed4c-0dd7-47d6-8c8d-a9e12153f538" /> | <img width="664" alt="Screenshot 2025-02-20 at 10 16 00" src="https://github.com/user-attachments/assets/2fb04fc5-35bc-4a30-b9ef-4f8e736cec86" /> | | Inline code reference | <img width="648" alt="Screenshot 2025-02-20 at 10 16 20" src="https://github.com/user-attachments/assets/0a392912-e624-4ce1-bfe9-a02dac4b0206" /> | <img width="666" alt="Screenshot 2025-02-20 at 10 16 31" src="https://github.com/user-attachments/assets/b9f8ba05-566c-4caf-8b98-dc1feff5ea1d" /> |
- Loading branch information
1 parent
605ed34
commit 49e3f1c
Showing
37 changed files
with
601 additions
and
498 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Code snippet | ||
.app-code-snippet { | ||
background-color: $color_nhsuk-white; | ||
border: 1px solid $nhsuk-border-color; | ||
overflow: auto; | ||
padding: nhsuk-spacing(1) nhsuk-spacing(3); | ||
margin-bottom: nhsuk-spacing(3); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Highlight code within body copy | ||
// This uses the same styling as on the NHS Service Manual | ||
p code, | ||
li code { | ||
background-color: $color_nhsuk-white; | ||
color: #d14; | ||
padding: 2px nhsuk-spacing(2); | ||
word-break: break-word; | ||
} |
Oops, something went wrong.