Built-In Syntax Highlighting

 I found this at Moonshots Beyond the Cloud, at his article, How to Add Code Syntax Highlighting to Blogger . I found that HTML tags need to be added in compose view before switching to HTML view to add the <pre> and <code> tags around any code to be formatted. 

This goes in the <head> section. Seems to be working.


<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/styles/default.min.css" integrity="sha512-3xLMEigMNYLDJLAgaGlDSxpGykyb+nQnJBzbkQy2a0gyVKL2ZpNOPIj1rD8IPFaJbwAgId/atho1+LBpWu5DhA==" crossorigin="anonymous" referrerpolicy="no-referrer" />

<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/highlight.min.js" integrity="sha512-Pbb8o120v5/hN/a6LjF4N4Lxou+xYZ0QcVF8J6TWhBbHmctQWd8O6xTDmHpE/91OjPzCk4JRoiJsexHYg4SotQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

<script>hljs.highlightAll();</script>

I see what he means about the <p> tags. Not totally sure about having this built in when I already have so many codes highlighted, some in different ways. Still testing with this Blogger interface.

 

Comments (3)