[mv3] Use custom tokens for YAML document boundaries

This commit is contained in:
Raymond Hill 2025-06-24 10:41:39 -04:00
parent 8bcf533fc0
commit d9aba4acca
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
3 changed files with 8 additions and 6 deletions

View file

@ -31,8 +31,7 @@ section[data-pane="develop"] > div > * {
height: 100%;
}
#cm-container .cm-editor .cm-line:has(.ͼ5),
#cm-container .cm-editor .cm-line:has(.ͼw) {
#cm-container .cm-editor .cm-line:has(.yamlboundary) {
background-image: url('line-hor-dashed.png'), url('line-hor-dashed.png');
background-position: left 3px, left calc(100% - 3px);
background-repeat: repeat-x;

View file

@ -557,9 +557,9 @@ class Editor {
},
token: (stream, state) => {
if ( stream.sol() ) {
if ( stream.match(/^---\s*$/) ) { return 'meta'; }
if ( stream.match(/^# ---\s*$/) ) { return 'meta comment'; }
if ( stream.match(/\.\.\.\s*$/) ) { return 'meta'; }
if ( stream.match(/^---\s*$/) ) { return 'yamlboundary'; }
if ( stream.match(/^# ---\s*$/) ) { return 'yamlboundary comment'; }
if ( stream.match(/\.\.\.\s*$/) ) { return 'yamlboundary'; }
}
const c = stream.peek();
if ( c === '#' ) {
@ -597,6 +597,9 @@ class Editor {
languageData: {
commentTokens: { line: '#' },
},
tokenTable: [
'yamlboundary',
],
};
}

@ -1 +1 @@
Subproject commit 4352f572758bc43ebabddb67b98875e8fde7c297
Subproject commit 4bacc0ca79f3eb4c6e395bf54d3f5efe4da4e07c