无IDE时,使用支持HTML5的浏览器作编辑器的方法

本文介绍如何在在线编辑器中配置不同编程语言模式及主题样式,支持C/C++、Python、Java等多种语言,并提供了丰富的主题选择。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

 

转载于:https://www.cnblogs.com/aqing1987/p/4276362.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值