Regex GTKSourceView语言标记HTML注释
我已经编辑了Jean-Philippe Fleury的gtksourceview语言文件,用于标记。这是我的改进版本: 这一个使用了特定于标记的样式,这是我在一个同样经过编辑的样式文件中定义的: 我用于GEdit的这些文件 然而,我还不是很满意。这些属性用于定义元数据中注释的外观。它们已经匹配了html注释,但是tommorow_night-Eights主题对注释使用了一些颜色,我不想在标记文件中使用这些颜色,但希望在其他源代码文件中使用 我认为解决这个问题的方法是在这些属性中添加一个减号,希望它们不再与html注释匹配,并为html注释定义我自己的正则表达式,并赋予另一种颜色 在已经包含的链接GIST中,但不知何故无法正常工作。html注释仍然根据元数据中的属性进行匹配和突出显示,并且忽略my regexRegex GTKSourceView语言标记HTML注释,regex,markdown,gedit,gtksourceview,Regex,Markdown,Gedit,Gtksourceview,我已经编辑了Jean-Philippe Fleury的gtksourceview语言文件,用于标记。这是我的改进版本: 这一个使用了特定于标记的样式,这是我在一个同样经过编辑的样式文件中定义的: 我用于GEdit的这些文件 然而,我还不是很满意。这些属性用于定义元数据中注释的外观。它们已经匹配了html注释,但是tommorow_night-Eights主题对注释使用了一些颜色,我不想在标记文件中使用这些颜色,但希望在其他源代码文件中使用 我认为解决这个问题的方法是在这些属性中添加一个减号,希望
html块注释
正则表达式是:
<!--
(literally this kind of comment!)
somehow still not working!
-->
<context id="html-block-comment" style-ref="html-block-comment">
<match extended="true">
^.* # at the beginning of the line an arbitrary amount of any characters
( # begin capture group 1
<!-- # the begin marker of an html comment
[^>]* # everything except >
--> # the end marker of an html comment
) # end of capturing group 1
.*$ # an arbitrary amount of any characters until line end
</match>
</context>
^.#在行首任意数量的任意字符
(#开始捕获第1组
!——#html注释的开始标记
除此之外的一切
--#html注释的结束标记
)#捕获组1结束
.*$#行结束前任意数量的任意字符
我已经将其包含在标记语法中(在最底部):
在lang文件的顶部有一个样式定义:
<styles>
<!-- Markdown styles. -->
<style id="header" _name="Header" map-to="def:type"/>
<style id="horizontal-rule" _name="Horizontal Rule" map-to="def:type"/>
<style id="code" _name="Code" map-to="def:identifier"/>
<style id="blockquote-marker" _name="Blockquote Marker" map-to="def:shebang"/>
<style id="label" _name="Label" map-to="def:preprocessor"/>
<style id="attribute-value" _name="Attribute Value" map-to="def:constant"/>
<style id="image-marker" _name="Image Marker" map-to="def:shebang"/>
<style id="backslash-escape" _name="Backslash Escape" map-to="def:special-char"/>
<style id="line-break" _name="Line Break" map-to="def:note"/>
<!-- Xiaolong added styles -->
<style id="list-marker" _name="List Marker" map-to="markdown:list-marker"/>
<style id="math-inline" _name="Math Inline" map-to="markdown:single-math-marker"/>
<style id="math-block" _name="Math Block" map-to="markdown:double-math-marker"/>
<style id="url" _name="URL" map-to="markdown:url"/>
<style id="link-text" _name="Link Text" map-to="markdown:link-text"/>
<style id="emphasis" _name="Emphasis" map-to="markdown:emphasis"/>
<style id="strong-emphasis" _name="Strong Emphasis" map-to="markdown:strong-emphasis"/>
<style id="html-block-comment" _name="HTML Block Comment" map-to="markdown:html-block-comment"/>
<!-- Markdown Extra styles. -->
<style id="header-id-marker" _name="Header Id Marker" map-to="def:shebang"/>
<style id="definition-list-marker" _name="Definition List Marker" map-to="def:shebang"/>
<style id="footnote-marker" _name="Footnote Marker" map-to="def:shebang"/>
<style id="abbreviation-marker" _name="Abbreviation Marker" map-to="def:shebang"/>
<style id="abbreviation" _name="Abbreviation" map-to="def:preprocessor"/>
<style id="table-separator" _name="Table Separator" map-to="def:statement"/>
</styles>
此样式映射到样式XML文件,其中我有以下定义:
<style name="markdown:html-block-comment" foreground="#303030" bold="false" italic="false"/>
所以我想我已经准备好了,但显然不是这样
如何使它只使用我的regex for html注释
<style name="markdown:html-block-comment" foreground="#303030" bold="false" italic="false"/>