Browse Source

Don't render Markdown if input or sanitized input is empty

bubble
Kyle Shockey 7 years ago
parent
commit
21100a0a8b
No known key found for this signature in database GPG Key ID: DC20D559FFBC0D36
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      src/core/components/providers/markdown.jsx

+ 6
- 0
src/core/components/providers/markdown.jsx View File

@@ -11,6 +11,12 @@ const sanitizeOptions = {


function Markdown({ source }) { function Markdown({ source }) {
const sanitized = sanitize(source, sanitizeOptions) const sanitized = sanitize(source, sanitizeOptions)

// sometimes the sanitizer returns "undefined" as a string
if(!source || !sanitized || sanitized === "undefined") {
return null
}

return <Remarkable return <Remarkable
options={{html: true, typographer: true, linkify: true, linkTarget: "_blank"}} options={{html: true, typographer: true, linkify: true, linkTarget: "_blank"}}
source={sanitized} source={sanitized}


Loading…
Cancel
Save