本文介绍了有没有JavaScript实时语法荧光笔?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了突出显示预先存在的代码的语法高亮显示,但我想在你用WYSIWYG风格的编辑器输入时这样做。我不需要自动完成的功能,只需突出显示。

I've found syntax highlighters that highlight pre-existing code, but I'd like to do it as you type with a WYSIWYG-style editor. I don't need auto-completed functions, just the highlighting.

作为后续问题,stackoverflow使用的WYSIWYG编辑器是什么?

As a follow-up question, what is the WYSIWYG editor that stackoverflow uses?

编辑:感谢下面的答案,我发现两个看起来可能符合我的需求:

Thanks to the answer below, I found two that look like they might suit my needs:EditArea and CodePress

编辑:也看到这个问题:

See this question also:
https://stackoverflow.com/questions/379185/free-syntax-highlighting-editor-control-in-javascript

推荐答案

这是一篇非常有趣的文章,关于如何编写一篇文章:(更好的是,他为JavaScript格式化程序和着色器提供了完整的源代码。)

Here is a really interesting article about how to write one: (Even better, he gives the full source to a JavaScript formatter and colorizer.)



DOM树黑暗面的残酷冒险

Implementing a syntax-higlighting JavaScript editor in JavaScriptorA brutal odyssey to the dark side of the DOM tree

重要的是,它正确处理正则表达式。同样令人感兴趣的是,他使用了延续传递样式词法分析器/解析器,而不是你将在野外看到的更典型的基于lex(或正则表达式)的词法分析器。

Importantly, it handles regex correctly. Also of interest is that he used a continuation passing style lexer/parser instead of the more typical lex (or regex) based lexers that you'll see in the wild.

作为奖励,他讨论了在浏览器中使用JavaScript时遇到的许多实际问题。

As a bonus he discusses a lot of real-world issues you'll run into when working with JavaScript in the browser.

这篇关于有没有JavaScript实时语法荧光笔?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 13:34