Closed bpruitt-goddard closed 2 years ago
Currently, rules are written using the custom regex
yaml type:
- match: !regex |-
(title)\s+ # title
(\s*["\(\)$&%\^/#.,?!;:*+=<>\'\\\-\w\s]*) # text
captures:
'1':
name: keyword.control.mermaid
'2':
name: string
YAML supports variables, but only for a single value, not for both the match
and the capture
that we would desire. To implement something like this, we would need to diverge from the spec and add a bit of custom work inside the regex
type, which would make it harder for new folks to contribute:
- match: !regex |-
(title)\s+ # title
&text_match
captures:
'1':
name: keyword.control.mermaid
'2':
name: &text_capture
Instead, I think relying on the new test suite and trying to avoid duplication by using begin
/end
blocks in favor of multiple match
blocks can help avoid this problem.
Closing this issue for now.
Everything is declared in-line. Use some variables to get this going.
Example:
Then use it like this: