add md block info
This commit is contained in:
parent
0bc3054e59
commit
ddd997e3f0
3 changed files with 33 additions and 1 deletions
|
|
@ -598,6 +598,18 @@ x: {
|
|||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "md_block_string_err",
|
||||
|
||||
text: `test: |md
|
||||
# What about pipes
|
||||
|
||||
Will escaping \| work?
|
||||
|
|
||||
`,
|
||||
expErr: `d2/testdata/d2compiler/TestCompile/md_block_string_err.d2:4:19: unexpected text after md block string. See https://d2lang.com/tour/text#advanced-block-strings.
|
||||
d2/testdata/d2compiler/TestCompile/md_block_string_err.d2:5:1: block string must be terminated with |`,
|
||||
},
|
||||
{
|
||||
name: "underscore_edge_existing",
|
||||
|
||||
|
|
|
|||
|
|
@ -413,7 +413,11 @@ func (p *parser) parseMap(isFileMap bool) *d2ast.Map {
|
|||
if after != p.pos {
|
||||
if n.Unbox() != nil {
|
||||
if n.MapKey != nil && n.MapKey.Value.Unbox() != nil {
|
||||
p.errorf(after, p.pos, "unexpected text after %v", n.MapKey.Value.Unbox().Type())
|
||||
ps := ""
|
||||
if _, ok := n.MapKey.Value.Unbox().(*d2ast.BlockString); ok {
|
||||
ps = ". See https://d2lang.com/tour/text#advanced-block-strings."
|
||||
}
|
||||
p.errorf(after, p.pos, "unexpected text after %v%s", n.MapKey.Value.Unbox().Type(), ps)
|
||||
} else {
|
||||
p.errorf(after, p.pos, "unexpected text after %v", n.Unbox().Type())
|
||||
}
|
||||
|
|
|
|||
16
testdata/d2compiler/TestCompile/md_block_string_err.exp.json
generated
vendored
Normal file
16
testdata/d2compiler/TestCompile/md_block_string_err.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"graph": null,
|
||||
"err": {
|
||||
"ioerr": null,
|
||||
"errs": [
|
||||
{
|
||||
"range": "d2/testdata/d2compiler/TestCompile/md_block_string_err.d2,3:18:50-3:24:56",
|
||||
"errmsg": "d2/testdata/d2compiler/TestCompile/md_block_string_err.d2:4:19: unexpected text after md block string. See https://d2lang.com/tour/text#advanced-block-strings."
|
||||
},
|
||||
{
|
||||
"range": "d2/testdata/d2compiler/TestCompile/md_block_string_err.d2,4:0:57-5:0:59",
|
||||
"errmsg": "d2/testdata/d2compiler/TestCompile/md_block_string_err.d2:5:1: block string must be terminated with |"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue