LucienShui / PasteMe

PasteMe 是一个无需注册的文本分享平台(未登陆状态下只能使用阅后即焚),可以为文本设置密码和阅后即焚,支持二维码分享和各种一键复制,针对代码提供了额外的高亮功能。
https://pasteme.cn
GNU General Public License v3.0
1.19k stars 155 forks source link

[Feature request] support for user defined sytanx highlighting #86

Open NamelessAshone opened 4 years ago

NamelessAshone commented 4 years ago

It would be nice to add support for user defined sytanx highlighting.

LucienShui commented 4 years ago

Thanks for suggestion. It's a little hard but we would consider this.

ryanlee2014 commented 4 years ago

Do you mean a new feature which is similar to this? https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-custom-languages

NamelessAshone commented 4 years ago

Thanks for the reply :D

Simply use a file to specify the color of one token which is identified by regexp. This file contains pattern/color_code pairs. Like this

/regexp parttern/  <color code>|<named color>

/\[error.*/                #FF0000
/\[notice.*/               info
/\[info.*/                 info
/\[[a-zA-Z 0-9:]+\]/       #00FF00

By the way, Monaco Editor is too powerful.