如何使WordPress博客文章里面直接显示代码?

李华峰seo培训

如何使WordPress博客文章里面直接显示代码?

今天在发布文章的时候,文章里面需要插入代码,结果代码一写进去就直接解析了,在网上找了好久,找到了这个说明:如何使WordPress博客文章里面直接显示代码?

做技术的写博客,或者有些内容需要特殊显示的地方,就需要用到高亮显示这个功能。作者下载并使用了2种wordpress高亮显示插件,做了分析比较,希望对您的使用有所帮助。

首选推荐

Syntax Highlighter and Code Colorizer for WordPress

这是一个非常棒的代码高亮显示插件,支持几乎主流的开发语言和最标准的html代码高亮,有行数显示。缺点是输出的js太多。下面介绍如何使用此插件和下载地址。

使用方式:

将插件下载,然后激活。

新增文章,在需要高亮处的html编辑中加入如下代码:

  
public class Hello  
{  
    public static void Main()  
    {  
       System.Console.WriteLine("Hello, World!");  
    }  
}  

其中将code-alias更换为:

  Bash/shell, C#, C++, CSS, Delphi, Diff, Groovy, JavaScript, Java, Perl, PHP, Plain Text, Python, Ruby, Scala, SQL, Visual Basic and XML

当中的一种,例如html代码应如下写:

(

 你的html代码 

)

注意:请在wp后台发布文章时,内容为html状态时填写此代码。

李华峰推荐的站群服务器

目前评论: 10 条  其中:访客 10 条  博主 0 条

  1. betus promotion code betus promotion code 【农民】

    I came across your website, i think your blog is interesting, keep us posting.

  2. touziyimin touziyimin 【农民】

    you’re really a good webmaster. The web site loading speed is incredible. It seems that you’re doing any unique trick. Furthermore, The contents are masterwork. you’ve done a fantastic job on this topic!

  3. vigrx plus vigrx plus 【村长】

    thank you for this.. by the way, your layout is wonderful.

  4. bernard Strep bernard Strep 【农民】

    […]Nice post. I was checking continuously this blog and I’m impressed! Extremely helpful information specifically the last part :) I care for such info a lot. I was seeking this certain information for a long time. Thank you and best of luck[…]…

  5. custom made suits custom made suits 【农民】

    Really what I have been looking for today. I think this is still a point one can see controversial. Nevertheless thank you a lot for this! Will vistit you soon again

  6. custom made suits custom made suits 【农民】

    For sure what I have been looking for recently. In my opinion this is still a point one can see from both sides. Nevertheless thanks a lot for this! Greetings!

  7. sleep apnea symptoms and signs sleep apnea symptoms and signs 【农民】

    I just added this blog to my google reader, great stuff. Cannot get enough!

  8. frostwire download frostwire download 【农民】

    trying to find you on facebook, wats your profile

  9. 天津招聘网 天津招聘网 【农民】

    不错,谢谢分享!!

    • Bruce Bruce 【镇长】【站长】

      欢迎下次再来

seo诊断服务

发表评论


表情