Fragments Uncategorized

Automatic Code Syntax Highlighting in WordPress

When I started blogging, I immediately needed to include some code snippets in my post. The intuitive move was trying to find a WP plug-in that can do this job.

I installed some of the top plugins that branded as code highlighting tools. However, most of them require you to click the small button then paste your code into the pop-up.

I hate that. I write in MarkDown and I just wanna type ```.

I found a plugin that does automatic syntax highlighting, called code-prettifyGithub. It is what I want, except the fact that it doesn’t work with dark them.

Long story short. My final idea is using hightlight.js, but how can I integrate it with WordPress?

Then I found this: A WP plug-in called Header-and-footer-scripts.

With this, I can finally load Highlightjs and call it automatically.

Leave a Reply

Your email address will not be published. Required fields are marked *