SquareSpace - Code Syntax Highlighting

I like to write my blog posts in Markdown. A limitation of Squarespace is that my code blocks are missing syntax highlighting and differentiation from the surrounding code. There are a few posts about this, and I originally looked at this one regarding Prism.js . Unfortunately, those formatting problems mentioned, and the fact that it wasn’t working with my Markdown flow, meant that I wasn’t satisfied with it as a solution. When it comes to blogging, I want as few roadblocks in the way as possible. The extra spacing it put in was just ugly as well.

Another blog post suggested using highlight.js . Following those instructions, I got it working almost immediately. I didn’t bother going further than that initial step as I haven’t (yet) encountered the issues the author mentions.

One thing I had to do was include Swift support as it’s not in the common set.

My injected code (in the footer, as suggested in Mike Raynham’s post ) is below:

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/styles/atom-one-light.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/highlight.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/languages/swift.min.js"></script>

It's applied automatically too. And hey, it even works for the example in the post about how to enable syntax highlighting.

Time To Try This Blogging Lark Again

Who knows if I'll stick with it but every so often the urge will strike. Same thing happens with social sites like Twitter and Instagram, though I find the signal to noise ratio a lot more bearable with Instagram so I tend to stick with it more. Perhaps I just need a better tool to manage the twitter environment - or just be much less self-conscious about what I'm putting out there. I don't feel quite the same way about a lengthy blog post. Perhaps it's because someone has to come here to read it instead of me pushing it out into a public forum.