代码一:
<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=""bar""/>
</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";
}
}