Skip to content

Commit

Permalink
Fix markdown code inline as empty error.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jun 14, 2018
1 parent 3a7d82a commit ccab899
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions theme/default/lib/markdown/InlineCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export default class Canvas extends PureComponent {
});
}
render() {
const code = this.props.value.replace(/^__dome__/, '').replace(/\\`/g, '`');
const sourceCode = this.props.value || '';
const code = sourceCode.replace(/^__dome__/, '').replace(/\\`/g, '`');
const PreCode = height => (
<pre className={styles.highlight} style={{ height }}>
<code ref={node => this.codeDom = node} className={classNames('hljs', { [`language-${this.props.language}`]: this.props.language })}>
Expand All @@ -26,7 +27,7 @@ export default class Canvas extends PureComponent {
);
const isPreview = /^(html|htm)$/.test(this.props.language);

if (/^__dome__/.test(this.props.value)) {
if (/^__dome__/.test(sourceCode)) {
return (
<div className={styles.demo}>
{isPreview && (
Expand Down

0 comments on commit ccab899

Please sign in to comment.