• 请不要在回答技术问题时复制粘贴 AI 生成的内容
kenneth
V2EX  ›  程序员

代码着色怎么无法显示html?

  •  
  •   kenneth · Dec 30, 2012 · 2910 views
    This topic created in 4908 days ago, the information mentioned may be changed or developed.
    http://www.mvmap.com/code/2
    想写一个简单的代码分享服务,但是代码着色无法显示html,不知道错哪里?
    用的是google-code-prettify库
    7 replies    1970-01-01 08:00:00 +08:00
    bindiry
        1
    bindiry  
       Dec 30, 2012
    难道需要把 ">" 转成 "&gt;", "<" 转成 "&lt;" ?
    bindiry
        2
    bindiry  
       Dec 30, 2012
    难道需要把 ">" 转成 "&gt ;", "<" 转成 "&lt ;" ?
    bindiry
        3
    bindiry  
       Dec 30, 2012
    kenneth
        4
    kenneth  
    OP
       Dec 30, 2012
    @bindiry 确实用pre标签,但是不知道是不是给转义了,就是一部分html代码没了
    kenneth
        5
    kenneth  
    OP
       Dec 30, 2012
    @bindiry 我看了下@SErHo的http://tocode.sinaapp.com代码,需要用xhtml_escape转义一下。现在OK了
    qiayue
        6
    qiayue  
    PRO
       Dec 31, 2012
    或者,你可以换一个插件,用SyntaxHighlighter,简单易用
    http://alexgorbatchev.com/SyntaxHighlighter/

    code4app 用的就是这个插件 http://code4app.com/snippets/one/iphone-swipe-left-and-right/50d54f106803fa7174000000#s0
    bindiry
        7
    bindiry  
       Dec 31, 2012
    @kenneth 原来如此,学习了。:)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3412 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 49ms · UTC 11:18 · PVG 19:18 · LAX 04:18 · JFK 07:18
    ♥ Do have faith in what you're doing.