1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

Reduce the code

This commit is contained in:
asmsuechan
2017-03-27 02:59:04 -07:00
parent 39274ce483
commit adf81175f3

View File

@@ -261,8 +261,7 @@ export default class MarkdownPreview extends React.Component {
const codeBlocks = value.match(/(```)(.|[\n])*?(```)/g) const codeBlocks = value.match(/(```)(.|[\n])*?(```)/g)
if (codeBlocks !== null && codeBlocks.length > 0) { if (codeBlocks !== null && codeBlocks.length > 0) {
codeBlocks.forEach((codeBlock) => { codeBlocks.forEach((codeBlock) => {
const encodedCodeBlock = encodeHTMLEntities(codeBlock) value = value.replace(codeBlock, encodeHTMLEntities(codeBlock))
value = value.replace(codeBlock, encodedCodeBlock)
}) })
} }
this.refs.root.contentWindow.document.body.innerHTML = markdown.render(value) this.refs.root.contentWindow.document.body.innerHTML = markdown.render(value)