带有语法着色的HTML编辑器的jQuery插件 [英] jQuery Plugin for HTML Editor with Syntax Coloring

查看:100
本文介绍了带有语法着色的HTML编辑器的jQuery插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个jQuery插件,该插件将显示用于HTML创作&的文本区域.编辑.

I'm looking for a jQuery Plugin that will display a textarea for HTML authoring & editing.

我正在寻找的东西:

  1. 必须支持创作HTML,而不是所见即所得表示形式
  2. 必须像键入任何富客户端IDE一样为HTML着色.
  3. 应该是jQuery,但是原生JS也可以.

我玩过MarkItUp,可让我90%在那里,但不提供语法着色.据我所知,WYMeditor没有代码视图"选项,而只是一个所见即所得"视图.

I have played with MarkItUp which gets me 90% there but offers no syntax coloring. And WYMeditor as far as I can tell has no option for "code view" and is instead just a WYSIWYG view.

过去有人在做这样的事情吗?

Anybody out there done something like this in the past?

推荐答案

使用 CodeMirror .它是Google用于其API运动场的荧光笔.

Use CodeMirror. It's the highlighter used by Google for their API playground.

我已经尝试过了,并且效果很好,并且根据他们的网站,它可以在以下浏览器中运行:

I've tried it and it works well, and according to their site it works in the following browsers:

  • Firefox 1.5或更高版本
  • Internet Explorer 6或更高版本
  • Safari 3或更高版本
  • Opera 9.52或更高版本
  • Chrome

我不明白您为什么在这种情况下提及jQuery,因为jQuery与您需要执行的操作无关,除了它的选择器引擎之外,该选择器引擎可用于查找要为其启用语法突出显示的文本框(尽管如果您在其上放置id,则也不需要jQuery.)

I don't understand why you mention jQuery in this case, since jQuery has nothing relevant to what you need to do, other than its selector engine which could be used to find the textbox you want to enable syntax highlighting for (although if you put an id on it you shouldn't need jQuery for that either.)

最好使用专门为解决手头任务而设计的独立库(CodeMirror是这样).您将获得最佳性能,并且开发人员将更易于维护,从而确保更好的质量.代码.

It's better to go with a stand-alone library that is especially designed to solve the task at hand (which CodeMirror is.) You'll get maximum performance and it'll be much more maintainable by the developers, ensuring better quality of the code.

这篇关于带有语法着色的HTML编辑器的jQuery插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆