From e39346ed8c78546fcf888003ac2ed6b06aaa16f3 Mon Sep 17 00:00:00 2001 From: Sang Jun Lee Date: Sun, 2 Jul 2017 16:27:49 +0900 Subject: [PATCH 1/3] Fix issue #329. --- src/components/markdown.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/markdown.js b/src/components/markdown.js index e75fb582b..746bccebf 100644 --- a/src/components/markdown.js +++ b/src/components/markdown.js @@ -70,7 +70,8 @@ const compile = marksy({ export default class Markdown extends Component { static propTypes = { children: PropTypes.node, - style: PropTypes.object, + source: PropTypes.string, + style: PropTypes.object }; static defaultProps = { @@ -78,7 +79,14 @@ export default class Markdown extends Component { }; render() { - const { style, children } = this.props; + const { style, children, source } = this.props; + if (source) { + return ( +
+ {compile(source).tree} +
+ ); + } return (
{compile(children).tree} From 82f15626951f412350a80eed2c26af9b9b89f118 Mon Sep 17 00:00:00 2001 From: Sang Jun Lee Date: Sun, 2 Jul 2017 16:28:02 +0900 Subject: [PATCH 2/3] Fix test cases failure because of blank line. --- src/components/__snapshots__/markdown-slides.test.js.snap | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/components/__snapshots__/markdown-slides.test.js.snap b/src/components/__snapshots__/markdown-slides.test.js.snap index ce6cb5f7c..1e9966ca9 100644 --- a/src/components/__snapshots__/markdown-slides.test.js.snap +++ b/src/components/__snapshots__/markdown-slides.test.js.snap @@ -13,7 +13,6 @@ exports[`MarkdownSlides should render correctly when using function syntax 1`] = > ## Slide A Title - - ## Slide B Title @@ -45,7 +43,6 @@ exports[`MarkdownSlides should render correctly when using tagged template liter style={Object {}} > ## Slide 1 Title - - ## Slide 2 Title @@ -77,7 +73,6 @@ exports[`MarkdownSlides should render correctly when using tagged template liter > ## Slide 1 Title This text is **bold**. - - ## Slide 2 Title From 0da0ff7c9f8cc52cbdadde7345cf80bef864abee Mon Sep 17 00:00:00 2001 From: Sang Jun Lee Date: Sun, 2 Jul 2017 16:43:50 +0900 Subject: [PATCH 3/3] Remove deleted Markdown props on README. --- README.markdown | 1 - 1 file changed, 1 deletion(-) diff --git a/README.markdown b/README.markdown index dcb6fd75a..b857de025 100644 --- a/README.markdown +++ b/README.markdown @@ -333,7 +333,6 @@ Markdown generated tags aren't prop configurable, and instead render with your t |Name|PropType|Description| |---|---|---| |source|PropTypes.string| Markdown source | -|mdastConfig| PropTypes.object | Mdast configuration object | ### Element Tags