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?
相关问题
- Display product ACF field value in Woocommerce tra
- Adding a custom button after add to cart button in
- How to add a “active” class to a carousel first el
- Setting custom order statuses as valid for payment
- change the font size in tag cloud
相关文章
- wordpress新增页面如何个性化设置
- select query in wordpress
- Get WooCommerce featured products in a WP_Query
- Woocommerce update shipping methods in checkout vi
- Change order status just after payment in WooComme
- Publishing or uploading failed. Error message: “Th
- Facebook Login With WP JWT Auth
- Wordpress development process
The best way for syntax highlighting is using prismjs, which is completely free with awesome features.
It has support for almost all programming languages, shell scripts and much more.
It is very light weight and it will not bog down your sites speed like other syntax highlighting plugins.
For configuring prismjs you need to do little code tweaks in your function.php file. Follow the turoails in this blog http://skillslane.com/setup-syntax-highlighter-for-wordpress/
You could use the Alex Gorbatchev's SyntaxHighlighter. Its javascript and really simple and well supported, easy to install and modify. Here are some instructions for blogger... but all you have to do you to do is remove the blogger=true line.
http://code-slim-jim.blogspot.com/2010/11/adding-syntax-higher-to-your-blog.html
If you don't want to, or can't install stuff on your blog, I suggest you use pygments to highlight your code. I described this here.
SyntaxHighlighter is a pretty good tool. It uses JavaScript with CSS classes to mark HTML elements that should be highlighted. It also allows code to be copied to the clipboard and printed.
Here is an offline option (I know you are asking about online tool but just in case ...)
I use offline tools to process the blog entry with source code examples into html format and then just post the html.
It's really just:
:::html
python script:
I setup markdown with pygments probably you could just use pygments for source code. You run the file thought the script and then copy paste the html to your blog.
You can dump css style, to highlight syntax, from pygments and then either link to it or include it in your page. I'm not sure if wordpress supports that.
Here is how to setup markdown with pygments to do syntax highlighting (for Blogger - the only specifics for Blogger is that it updates the Blogger css with the css to highlight code).
http://wordpress.org/extend/plugins/devformatter/
WP Plugin for various syntax highlighting!