Sublimetext3 因为根据包作者的定义,语法不会生成该范围

Sublimetext3 因为根据包作者的定义,语法不会生成该范围,sublimetext3,Sublimetext3,PlainNotes提供的颜色方案有注释规则,但仅适用于块注释,而不适用于我们在这里使用的行注释。您可以通过在notes文件中使用HTML注释并看到它在视觉上的变化来看到这一点 最方便的修复方法是修改注释规则应用的范围,以便它们应用PlainNotes期望的范围: comments: - match: '//' scope: punctuation.definition.comment.begin.html push: - meta_scope

PlainNotes提供的颜色方案有注释规则,但仅适用于块注释,而不适用于我们在这里使用的行注释。您可以通过在notes文件中使用HTML注释并看到它在视觉上的变化来看到这一点

最方便的修复方法是修改注释规则应用的范围,以便它们应用PlainNotes期望的范围:

  comments:
    - match: '//'
      scope: punctuation.definition.comment.begin.html
      push:
        - meta_scope: comment.block.html
        - match: $\n?
          pop: true
有了它,我们可以在段落中注释单行或内行,并获得我们期望的语法突出显示:

根据您的使用情况,这可能不足以允许在您想要的所有位置进行注释

例如,标题中不可能有注释,因为有一个
match
规则将标题作为一个完整的行进行匹配,该规则在任何内容匹配之前先使用注释标记


修复这一问题需要修改标题的匹配规则,使其工作方式与注释类似(即推送
上下文
,以便您可以
包含
注释),这可能值得,也可能不值得。

真棒的答案!我已经在使用Monokai配色方案(“配色方案”:“Packages/User/Monokai.sublime配色方案”在Note.sublime设置中),因为我不喜欢PlainNotes中默认的黄色配色方案。因此,陷阱3不适用于我。通过这样做,我可能会错过一些突出的壮举,但我不介意
- match: '//'
  scope: punctuation.definition.comment.begin.html
  push:
    - meta_scope: comment.line.double-slash.html
    - match: $\n?
      pop: true
This is a single line

This is a paragraph of
text that is spread over
several lines.
  comments:
    - match: '//'
      scope: punctuation.definition.comment.begin.html
      push:
        - meta_scope: comment.line.double-slash.html
        - match: $\n?
          pop: true
  main:
    - include: comments
    ...
    - match: '^(?=\S|[ ]{1,3})(?![=-]{3,}(?=$))'
      push:
        - meta_scope: meta.paragraph.markdown
        - include: comments
        ...
  comments:
    - match: '//'
      scope: punctuation.definition.comment.begin.html
      push:
        - meta_scope: comment.block.html
        - match: $\n?
          pop: true