Search code examples
regexsublimetext3sublime-syntax

Sublime syntax: Parse two consecutive lines


With the .sublime-syntax format, how would you match the following:

This is a title
===============

This is valid Markdown and AsciiDoc, and maybe also reStructuredText.

How would you match this as a section heading? This is a title here, without knowing the next line, could also be the beginning of a paragraph, hence the challenging ambiguity: at this point, you can't make it part of a heading scope.


Solution

  • This is currently not possible, which is why the Markdown syntax definition that ships with ST can only scope the underline characters as a heading, and not the heading text itself.

    There is a feature request for multiline match support in .sublime-syntax files here: https://github.com/SublimeTextIssues/Core/issues/1693