本站使用了 Pjax 等基于 JavaScript 的开发技术,但您的浏览器已禁用 JavaScript,请开启 JavaScript 以保证网站正常显示!

代码高亮实现功能【终于实现在线代码高亮了】

 

代码一:

<foobar>
<blah>Enter your xml here and press the button below to display
it as highlighted by the CodeMirror XML mode</blah>
<tag2foo="2"bar="&quot;bar&quot;"/>
</foobar>

代码二:

a { color:#0000CC; text-decoration:none; }
a:visited { color:#0000CC; text-decoration:none; }
a:hover { text-decoration:underline; }
a img { padding: 0px; margin: 0px auto; border-style:none; }
img { padding: 0px; margin: 0px auto; border-style:none; }
input:focus, select:focus, textarea:focus {
  border: 1px solid #ff00ff;
  background:#FFFFBB;
}

  function html(stream, state) {
    var style = htmlMode.token(stream, state.htmlState);
    if (style == "tag" && stream.current() == ">" && state.htmlState.context) {
      if (/^script$/i.test(state.htmlState.context.tagName)) {
        state.token = javascript;
        state.localState = jsMode.startState(htmlMode.indent(state.htmlState, ""));
        state.mode = "javascript";
      }
      else if (/^style$/i.test(state.htmlState.context.tagName)) {
        state.token = css;
        state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
        state.mode = "css";
      }
    }


Offer

推广

 继续浏览关于 的文章

 本文最后更新于:2014/10/24 17:55:30,可能因经年累月而与现状有所差异

 引用转载请注明:诗恩有趣cnfunny - 有趣的 > 杂谈 > 代码高亮实现功能【终于实现在线代码高亮了】