浏览器编辑器中的简单语法突出显示

发布于 2024-12-01 11:43:07 字数 315 浏览 0 评论 0原文

我一直在考虑在编辑文本时突出显示文本中的各种文本。我玩过代码镜像,虽然它令人印象深刻,但为其创建另一种模式太难了。

理想情况下,我能够用正则表达式来指示我想要突出显示的内容。或者同样简单的事情。

作为一个例子,我想强调@username twitter 风格和#tag。在某些情况下,一行以 开始。

property::

值得强调一下。

为代码镜像创建一个非常愚蠢的解析器的简单方法将非常酷,这样对于比我更有 JS 天赋的人来说,高级选项就存在了。

我有一种可怕的感觉,这件事很难做到。

欢迎所有建议。

I've been looking at highlighting various bits of text in a text are as they are being edited. I've had a play with code mirror, whilst its seriously impressive its just too hard create another mode for it.

Ideally I'd be able to indicate what I want to highlight with a regular expression. Or something equally simple.

as an example I'd like to highlight @username twitter style and #tag as well. There are cases where a line starts with.

property:: value

that would be nice to emphasise too.

A simple way of creating a really dumb parser for code mirror would be very cool, that way the advanced option is there for someone with more JS talent than me.

I've got a horrible feeling that this is something that is just hard to do though.

All suggestions welcome.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文