skanaar / nomnoml

The sassy UML diagram renderer
https://www.nomnoml.com
MIT License
2.7k stars 209 forks source link

Parse error at line 2 column 35, expected "label" but got "[" #219

Open jumangee opened 7 months ago

jumangee commented 7 months ago

Trying to render with: nomnoml.renderSvg(code) next code:

[<note id=id12735b4d7f8847b> 111]
[<note id=ide0d67858d04d774> 222]
[ide0d67858d04d774] --> [id12735b4d7f8847b]

receiving this error:

Error: Parse error at line 2 column 35, expected "label" but got "[" ParseError https://quest-book.ru/utils/uniarchedit/js/nomnoml.js:918 error https://quest-book.ru/utils/uniarchedit/js/nomnoml.js:902 parseAssociation https://quest-book.ru/utils/uniarchedit/js/nomnoml.js:769 parseNodesAndAssocs https://quest-book.ru/utils/uniarchedit/js/nomnoml.js:743 parsePart https://quest-book.ru/utils/uniarchedit/js/nomnoml.js:715 linearParse https://quest-book.ru/utils/uniarchedit/js/nomnoml.js:682 parse https://quest-book.ru/utils/uniarchedit/js/nomnoml.js:927 parseAndRender https://quest-book.ru/utils/uniarchedit/js/nomnoml.js:1709 renderSvg https://quest-book.ru/utils/uniarchedit/js/nomnoml.js:1725 render https://quest-book.ru/utils/uniarchedit/js/models/render/nomnoml.js:9 render https://quest-book.ru/utils/uniarchedit/js/models/render/nomnoml.js:8 parse https://quest-book.ru/utils/uniarchedit/js/models/generator/nomnoml.js:126

but code nicely renders in online app: изображение

Using local nomnoml.js from github repo, but //unpkg.com/nomnoml/dist/nomnoml.js gives same error

What's wrong?

skanaar commented 6 months ago

I cannot reproduce this bug.

A html-dokument with this code works fine.

<script src="//unpkg.com/graphre/dist/graphre.js"></script>
<script src="//unpkg.com/nomnoml/dist/nomnoml.js"></script>
<script>
    var svg = nomnoml.renderSvg(`[<note id=id12735b4d7f8847b> 111]
[<note id=ide0d67858d04d774> 222]
[ide0d67858d04d774] --> [id12735b4d7f8847b]`)
    document.write(svg)
</script>

Which browser are you using? Are you at the latest nomnoml version 1.6.2?

anuraagvaidya commented 1 month ago

Replace your file's line separator from CRLF to LF and it should work.