tufte-markdown icon indicating copy to clipboard operation
tufte-markdown copied to clipboard

throws on an empty figure tag

Open CxRes opened this issue 6 years ago • 0 comments

Suppose one places an empty figure tag

<figure></figure>

I get an error

TypeError: Cannot read property 'type' of undefined
    at parseMarkdown (test\node_modules\@tufte-markdown\remark-figure-parser\dist\remark-figure-parser.cjs.js:15066:52)
    at Of.figureTokenizer (test\node_modules\@tufte-markdown\remark-figure-parser\dist\remark-figure-parser.cjs.js:15040:22)
    at Of.tokenize [as tokenizeBlock] (test\node_modules\remark-parse\lib\tokenizer.js:58:18)
    at Of.parse (test\node_modules\remark-parse\lib\parse.js:33:20)
    at Function.parse (test\node_modules\unified\index.js:271:45)
    at pipelineParse (\test\node_modules\unified\index.js:23:16)
    at wrapped (\node_modules\trough\wrap.js:25:19)
    at next (test\node_modules\trough\index.js:58:24)
    at Object.run (test\node_modules\trough\index.js:32:10)
    at executor (test\node_modules\unified\index.js:365:16)

I am not sure of how the AST works but I am guessing you need to test for result.children array not being empty????

CxRes avatar May 01 '19 12:05 CxRes