From d5f26a52d48ffa786c551e42c88263cee211e340 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Wed, 1 Nov 2017 13:40:00 -0700 Subject: [PATCH] Add the ability to render html and linkify links (#208) Marked had the ability to display html code. This is useful if you want to embed iframes, set size to images... This allows arbitrary html to be embedded with no sanitization, so `` will be executed. This isn't such a big issue since the markdown is written only by contributors. I also removed the componentWillUpdate call since it's not used (and wrong). --- lib/core/Remarkable.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/core/Remarkable.js b/lib/core/Remarkable.js index 710021a417..c39a9f795f 100644 --- a/lib/core/Remarkable.js +++ b/lib/core/Remarkable.js @@ -18,12 +18,6 @@ function anchors(md) { } class Remarkable extends React.Component { - componentWillUpdate(nextProps, nextState) { - if (nextProps.options !== this.props.options) { - this.md = new Markdown(nextProps.options); - } - } - content() { if (this.props.source) { return ; @@ -61,7 +55,9 @@ class Remarkable extends React.Component { } catch (err) {} return ''; - } + }, + html: true, + linkify: true, }); // Register anchors plugin @@ -90,12 +86,11 @@ class Remarkable extends React.Component { {this.content()} ); - } + } } Remarkable.defaultProps = { container: 'div', - options: {}, }; module.exports = Remarkable;