Highlighting specific lines using Crayon Syntax Highlighter

Here's a handy little tip if you are using the plugin Crayon Syntax Highlighter to display snippets of code on your WordPress site.

It's possible to mark particular lines as important so they appear highlighted.

If you are manually inserting the <pre> tag into your post, just give it a class with the following attribute:

This will highlight line 1 and lines 4-7 inclusive.

Alternatively, if you are using the Crayon 'Add Code' button in the visual editor, use the 'Marked Lines' field in much the same way:

Marked lines in Crayon

For more information about Crayon and the different attributes that can be used in the tag, see this great Crayon Readme on Packagist.

Notify of
Inline Feedbacks
View all comments
James Clark
Hi! I'm James Clark and this is my website. I publish all my guides completely free, so if you find them useful then please:
Copyright © James Clark
What do you think? Leave a commentx
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram