Improve error message when missing blank line between `---` and slide content
Describe the bug
If you start the slide with a comment it will crash out with the following:
[Vue warn]: Unhandled error during execution of component update
at <AsyncComponentWrapper>
at <SlideWrapper key="40" clicks-context=
Object { current: Getter & Setter, clicksStart: 0, relativeSizeMap: Getter, maxMap: Getter, isMounted: Getter, setup: setup(), calculateSince: calculateSince(rawAt, size), calculateRange: calculateRange(rawAt), calculate: calculate(at), register: register(el, info)
, … }
route=
Object { no: 4, meta: Proxy, load: async load4()
, component: {…} }
... >
at <TransitionGroup id="slideshow" tag="div" class="" ... >
at <SlidesShow render-context="slide" >
at <SlideContainer style=
Object { background: "var(--slidev-slide-container-background, black)" }
is-main="" onPointerdown=fn<onClick> ... >
at <Play onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref<
Proxy { <target>: Proxy, <handler>: {…} }
> >
at <RouterView>
at <App> [runtime-core.esm-bundler.js:51:12](https://rlmibmplyqgithub-lhp1--3030--d20a0a75.local-corp.webcontainer.io/node_modules/.pnpm/@[email protected]/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js?v=d9ecd089)
Uncaught (in promise) DOMException: String contains an invalid character
patchAttr runtime-dom.esm-bundler.js:620
patchProp runtime-dom.esm-bundler.js:793
mountElement runtime-core.esm-bundler.js:4873
processElement runtime-core.esm-bundler.js:4820
My guess is the unplugin-vue-markdown library being used is making an empty component and causing a blow up inside of SlidesShow. Tonight has been the very first night I have ever used vue and my tooling isn't really setup to dig any further. I hope this helps.
The bug I would classify as somewhat important as if I wasn't so stubborn I would have 100% abandoned sli.dev and moved on as this broke my slideshow completely and was making it unusable. It took me so long to notice because I wrote the entire presentations words prior to the slides inside of my md file.
Minimal reproduction
---
<--
Wow Much Commpent
-->
---
NOTE: if there is a blank line between --- and <!-- the error goes away
NOTE: if you have no more slides on left and place a <!-- comment block the error does not happen
Environment
- Slidev version: 51.0.2
- Browser: Chrome/Firefox (appears logic not browser issue)
- OS: Windows
In my opinion, the blank line between --- and <!-- is required. Otherwise, the <!-- ... part will be considered as frontmatter instead of slide content.
In my opinion, the blank line between
---and<!--is required. Otherwise, the<!-- ...part will be considered as frontmatter instead of slide content.
Agreed, the only issue is with the current implantation if somebody messes this up (a basic formatting oopsies) the entire slide application crashes and starts glitching. An error modal appearing to explain the fault would be amazing to those not running auto formatting.
A low priority high inconvenience kinda bug