diff --git a/CHANGELOG.md b/CHANGELOG.md index e3b8c001e..13f9ac13f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. **Fixed** * Fix color of hoshi points not being themed +* Fix Markdown links not working properly **Changed** diff --git a/src/components/ContentDisplay.js b/src/components/ContentDisplay.js index cfbf47684..0c6c789e4 100644 --- a/src/components/ContentDisplay.js +++ b/src/components/ContentDisplay.js @@ -78,18 +78,22 @@ class ContentDisplay extends Component { } } - render({tag, content}) { - return h(tag, Object.assign({ - ref: el => this.element = el, - dangerouslySetInnerHTML: { - __html: htmlify( - content - .replace(/&/g, '&') - .replace(//g, '>') - ) - } - }, this.props)) + render({tag, content, children}) { + return content != null + ? h(tag, Object.assign({ + ref: el => this.element = el, + dangerouslySetInnerHTML: { + __html: htmlify( + content + .replace(/&/g, '&') + .replace(//g, '>') + ) + } + }, this.props)) + : h(tag, Object.assign({ + ref: el => this.element = el + }, this.props), children) } } diff --git a/src/components/MarkdownContentDisplay.js b/src/components/MarkdownContentDisplay.js index a9a4901ec..8636a9a07 100644 --- a/src/components/MarkdownContentDisplay.js +++ b/src/components/MarkdownContentDisplay.js @@ -39,10 +39,10 @@ function Paragraph({children}) { } function Link({href, title, children}) { - if (href.match(/^((ht|f)tps?:\/\/|mailto:)/) == null) + if (href.match(/^((ht|f)tps?:\/\/|mailto:)/) == null) return h('span', {}, typographer(children)) - return h('a', {class: 'external', href, title}, typographer(children)) + return h(ContentDisplay, {}, h('a', {class: 'external', href, title}, typographer(children))) } function Image({src, alt}) {