popcode icon indicating copy to clipboard operation
popcode copied to clipboard

Backtick in CSS causes UI to crash

Open outoftime opened this issue 5 years ago • 1 comments

The following CSS will trigger the error:

.section{
    color:#f7beba;
        border-radius:200px;
    height:`0px;
}

body{background-color:#95beba;}
.name{text-align:center;}

Error in Popcode

Error in / Unknown language: isn't is not registered

View on Bugsnag

Stacktrace

View full stacktrace

Created by Matthew Brown via Bugsnag

outoftime avatar Oct 30 '20 18:10 outoftime

@outoftime This doesn't completely fix the issue, but we can stop the app from crashing by adding ignoreMissing: true to therehype-highlight plugin in remarkWithHighlighting() in src/util/markdown.js

return unified()
    .use(markdown)
    .use(externalLinks)
    .use(remark2rehype)
    .use(sanitize, schema)
    .use(highlight, {
      subset: ['css', 'js', 'xml'],
      languages: {css, js, xml},
      ignoreMissing: true,
    })
    .use(rehype2react, {createElement});

adrianfalleiro avatar Nov 03 '20 13:11 adrianfalleiro