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.

Leave a Reply

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

Copyright © James Clark
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram