mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-18 11:36:53 +02:00
feat: add @theme/Markdown to allow user modify their own markdown react component
This commit is contained in:
parent
1ff6733464
commit
d00864d222
8 changed files with 41 additions and 30 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue