How to blog code at wordpress.com [closed]

2019-01-29 20:04发布

got a new blog at wordpress few days ago (http://ghads.wordpress.com) and I want to post some code snippets now or then. Is there anyway to make it look like code without paying for extra plugins?

7条回答
淡お忘
2楼-- · 2019-01-29 20:12

You can also use hilite.me. It doesn't require installation of plugins or JS/CSS files. It's also open-source and has an API.

Disclaimer: I'm the developer.

查看更多
Luminary・发光体
3楼-- · 2019-01-29 20:13

With my Wordpress.org installation, I couldn't get the Accepted Answer here to work (not sure if that's only expected to work with Wordpress.com?)...

I ended up using the SyntaxHighlighter plugin instead.

With that plugin, at first, your code will appear escaped in 'Preview Changes' view: It will appear correctly then after publishing. I think thereafter publishing it will then appear correctly in 'Preview Changes' (not 100% about that).

查看更多
孤傲高冷的网名
4楼-- · 2019-01-29 20:19

There's a <code> html element you can use. Otherwise you could try the Textile or Markdown syntaxes (I'm not sure if WordPress.com uses them). Try it out and use the preview function in WordPress to see when you get it right.

查看更多
别忘想泡老子
5楼-- · 2019-01-29 20:19

You can also use the new web app I wrote called BlogTrog CodeWindow -- it's powered by Actipro CodeHighlighter.

http://www.blogtrog.com

It's free, should work in all modern browsers, and doesn't require you to install anything anywhere. Just paste your code and embed the results.

查看更多
聊天终结者
6楼-- · 2019-01-29 20:28

Crayon Syntax Highlighter is an excellent free plugin. I went with that one, but there are many others I came across that may serve the purpose:

查看更多
一夜七次
7楼-- · 2019-01-29 20:33

If you are hosting your own wordpress blog opposed to on WP.com you can get this functionality by installing this plugin, since it is the same plugin that the WP.com code relies on.

http://wordpress.org/extend/plugins/google-syntax-highlighter/

查看更多
登录 后发表回答