Skip to content

Throws exception if asked to parse HTML via web-tree-sitter #93

@savetheclocktower

Description

@savetheclocktower

Describe the bug

Reproducible from the playground:

cd tree-sitter-markdown
tree-sitter build-wasm . && tree-sitter playground

Code example

<h1>foo</h1>

Expected behavior
Any sane parsing of the tree would be useful here, but the specs suggest to me that the tree should render with an html_block node.

Actual behavior
Errors in both Chrome and Firefox. Here's the Chrome error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'apply')
    at e.<computed> (tree-sitter.js:1:10370)
    at 0016e4de:0x27a2
    at 0016e4de:0x1824
    at tree-sitter.wasm:0x24b5b
    at Parser.parse (tree-sitter.js:1:38110)
    at handleCodeChange (playground.js:115:28)
    at it (codemirror.min.js:1:17760)
    at jn (codemirror.min.js:1:65062)
    at codemirror.min.js:1:61536
    at codemirror.min.js:1:61545

Appears to happen only when the HTML is the first content on the line. If I start with a blank document, I can type < without an error, but <a is enough to cause the error, which then repeats with each keystroke.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions