Clear and concise description of the problem
When we use vueTemplate, if an incorrect syntaxe is provide to the compiler, the render disappear from the page and an error is throw in the console.
You can easily reproduce it here: https://vue-showdown.js.org/playground/. Just active vueTemplate and add <mycustomelement> into the input to throw the error.
Noticed that, the error is throwing only when the project is run in production mode. In dev mode, the render don't crash and warnings are display into the console.
Suggested solution
Add a try catch to the render function. If vueTemplate can't render the let showdown render it without vueTemplate option.
// vue-showdown.ts
return () => {
try {
return props.vueTemplate
? h({
setup: () => props.vueTemplateData,
template: `<${props.tag}>${outputHtml.value}</${props.tag}>`,
components: props.vueTemplateComponents,
})
: h(props.tag, {
innerHTML: outputHtml.value,
});
} catch (renderError) {
// Handle the exception and return only showdown render without vueTemplate
return h(props.tag, {
innerHTML: outputHtml.value,
});
}
}
Alternative
No response
Additional context
No response
Clear and concise description of the problem
When we use vueTemplate, if an incorrect syntaxe is provide to the compiler, the render disappear from the page and an error is throw in the console.
You can easily reproduce it here: https://vue-showdown.js.org/playground/. Just active
vueTemplateand add<mycustomelement>into the input to throw the error.Noticed that, the error is throwing only when the project is run in production mode. In dev mode, the render don't crash and warnings are display into the console.
Suggested solution
Add a try catch to the render function. If vueTemplate can't render the let showdown render it without vueTemplate option.
Alternative
No response
Additional context
No response