miaolz123 / vue-markdown

A Powerful and Highspeed Markdown Parser for Vue
https://miaolz123.github.io/vue-markdown/
MIT License
1.92k stars 258 forks source link

Bug with '#' if editing with TOC enabled #66

Open Tattomoosa opened 6 years ago

Tattomoosa commented 6 years ago

When Vue-Markdown is previewing a textarea that is being edited with the toc enabled, it throws an error when inputting # without a title after it.

This crashes the implementation in the live demo (markdown stops updating), but in my app it actually keeps working and just keeps throwing errors into the console.

Uncaught TypeError: Cannot read property 'type' of undefined
at Array.<anonymous> (vue-markdown.min.js:4)
at n.process (vue-markdown.min.js:2)
at s.parse (vue-markdown.min.js:1)
at s.render (vue-markdown.min.js:1)
at C (vue-markdown.min.js:1)
at VueMarkdown.<anonymous> (vue-markdown.min.js:1)
at Watcher.run (vue.js:3251)
at runBatcherQueue (vue.js:2984)
at Array.flushBatcherQueue (vue.js:2958)
at MutationObserver.nextTickHandler (vue.js:434)

To reproduce, turn on toc in the live demo

onedou commented 6 years ago

This issue is the same as mine

onedou commented 6 years ago

image

beebase commented 6 years ago

+1

zoi-aoba commented 6 years ago

me too

fangbinwei commented 5 years ago

I have the same problem. maybe toc should skip this situation?