3.13.1 • Published 4 years ago
@ray4105/js-yaml v3.13.1
JS-YAML-tweaked for transpiling my syntax highlighting extension
I've just copied JS-YAML here, and tweaked the readBlockScalar
function in lib/js-yaml/loader.js
from this:
if (didReadContent) { // i.e. only if we have already read some scalar content.
state.result += ' ';
}
to this:
// don't want the space added at each eol in a block scalar,
// so that we can write pure long regex spreading over multiple lines
// without the labor pains to escape the '\'
// 2020/03/30 20:22 Ray
if (didReadContent && chomping !== CHOMPING_STRIP) {
state.result += ' ';
}
And now we can do this:
- name: storage.type.function.rexx
match: >-
^\s*
[A-Za-z@#$!?_]
[A-Za-z@#$!?_0-9]*
:
and js-yaml
will generate this:
[
{
"name": "storage.type.function.rexx",
"match": "^\\s*[A-Za-z@#$!?_][A-Za-z@#$!?_0-9]*:"
}
]
Notice how no space added after *
, ]
and :
at the end of line.
All rights reserved for js-yaml
.
3.13.1
4 years ago