Skip to content

Commit

Permalink
feat: add support themes
Browse files Browse the repository at this point in the history
  • Loading branch information
yvmunayev committed Jul 29, 2020
1 parent 5c3fad5 commit 2642397
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/MarkdownOutput/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React from 'react';
import PropTypes from 'prop-types';
import useMarkdownToReact from './hooks/useMarkdownToReact';
import HighlightTheme from './highlightTheme';

export default function MarkdownOutput(props) {
const { id, className, style, value } = props;
const { id, className, style, value, highlightTheme } = props;
const result = useMarkdownToReact(value);
return (
<div id={id} className={className} style={style}>
<HighlightTheme id={id} className={className} style={style} theme={highlightTheme}>
{result}
</div>
</HighlightTheme>
);
}

Expand All @@ -21,11 +22,13 @@ MarkdownOutput.propTypes = {
style: PropTypes.object,
/** The markdown string to parse. */
value: PropTypes.string,
highlightTheme: PropTypes.oneOf(['github-gist', 'github', 'dracula']),
};

MarkdownOutput.defaultProps = {
id: undefined,
className: undefined,
style: undefined,
value: '',
highlightTheme: 'github-gist',
};

0 comments on commit 2642397

Please sign in to comment.