Let’s enabling syntax highlighting for Swift
The Squarespace supports syntax highlighting for HTML, CSS, and Javascript.
But It does not support other programming languages.
To enable it, We can choose the syntax highlighting plugins.
I recommend PrismJS
Download PrismJS css
and javascript
Select PrismJS option before downloading it.
-
Compression level to Minified version
-
Language for Swift
-
Plugins (e.g., line numbers)
Download the JS
and CSS.
That’s it.
Copy and Paste it into the Squarespace
Go to the setting Pages > Select your blog page (e.g., Posts)
Go to Advanced tap and Copy and Paste the CSS and Javascript code into the Post Blog Item Code injection
<style>
<!-- Paste Your PrismJS CSS -->
</style>
<script>
/*
Paste your PrismJS Javascript
*/
</script>
Now We can syntax highlighting for Swift
using Markdown
let greeting = "Welcome to Shawn Baek's blog!"
print(greeting)