PCYO 评测夜鸥 六度计算世界

少年强 则 中国强

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

代码一:

Enter your xml here and press the button below to display
it as highlighted by the CodeMirror XML mode

<tag2foo="2"bar=""bar""/>

代码二:
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";  
  }  
}




本原创文章未经允许不得转载 | 当前页面:PCYO 评测夜鸥 六度计算世界 » 代码高亮实现功能【终于实现在线代码高亮了】

评论