I'd like to have a good syntax highlighter for my WordPress blog. What options do I have available? I often see one which has well-colored syntax highlighting and options to copy to the clipboard. Does anyone have an idea what tool this is?
To add a SyntaxHighlighter Code block to a post or page you click on the + icon at the left of any empty block or at the top left of the editor then search for SyntaxHighlighter and click on the SyntaxHighlighter Code icon. Paste the code into the block. Next select the code language from the block settings.
Syntax highlighting is a styling format commonly used to display code. It adds line numbers and colors to highlight code patterns which makes it easy to understand.
When creating a new code block, select Code block, and then in the Inspector (Block Controls on the Right) select the language for the code. The code will not change within the editor, but you'll see a small label with the selected language.
On wordpress.com, you can't install plugins, so you have to use Wordpress' built-in widget.
Do it like:
[code language='python'] [/code]
Note that those tags go inside your visual editor, not the HTML editor.
You can find more information here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With