feat: add @theme/Markdown to allow user modify their own markdown react component

This commit is contained in:
endiliey 2018-09-06 21:33:50 +08:00
parent 1ff6733464
commit d00864d222
8 changed files with 41 additions and 30 deletions

View file

@ -9,27 +9,10 @@ export default class Docs extends React.Component {
const {route, docsData, siteConfig} = this.props;
const currentDoc = docsData.find(data => data.path === route.path);
const highlight = Object.assign(
{},
{
version: '9.12.0',
theme: 'default'
},
siteConfig.highlight
);
// Use user-provided themeUrl if it exists, else construct one from version and theme.
const highlightThemeURL = highlight.themeUrl
? highlight.themeUrl
: `https://cdnjs.cloudflare.com/ajax/libs/highlight.js/${
highlight.version
}/styles/${highlight.theme}.min.css`;
return (
<Layout {...this.props}>
<Helmet>
<title>{(currentDoc && currentDoc.title) || siteConfig.title}</title>
<link rel="stylesheet" type="text/css" href={highlightThemeURL} />
</Helmet>
<div className={styles.mainContainer}>{this.props.children}</div>
</Layout>