1、样例
在任务栏中输入以下内容后将开启c/c++ 模式
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/c_cpp");</script>
2、模式切换
想要使用其它模式的话,将代码中的ace/mode/c_cpp,替换为如下一种模式即可
Python -> ace/mode/python
C/C++ -> ace/mode/c_cpp
Java -> ace/mode/java
其它还支持 javascript, scala, coffeescript, css, html, php, latex, tex, sh, sql, lua, clojure, dart, typescript, go, groovy, json, jsp, less, lisp, lucene, perl, powershell, scss, textile, xml, yaml, xquery, liquid, diff
3、主题切换
将代码中的ace/theme/monokai,替换为如下一种主题
Eclipse -> ace/theme/eclipse
TextMate -> ace/theme/textmate
其它还支持github, ambiance, dawn, chaos, chrome, dreamweaver, xcode, vibrant_ink, solarized_dark, solarized_light, tomorrow, tomorrow_night, tomorrow_night_blue, twilight, tomorrow_night_eighties, pastel_on_dark
原文:http://www.cnblogs.com/aqing1987/p/4276362.html