mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +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
|
@ -5,14 +5,19 @@ module.exports = function(fileString) {
|
|||
const options = getOptions(this);
|
||||
|
||||
const {body} = fm(fileString);
|
||||
const source = JSON.stringify(body);
|
||||
|
||||
const content = JSON.stringify(body);
|
||||
// TODO replace all the markdown linking to correct url depends on whether it's versioned/translated/normal docs
|
||||
// e.g: [test](test.md) become [test](/docs/test)
|
||||
const siteConfig = JSON.stringify(options.siteConfig);
|
||||
|
||||
return (
|
||||
`import React from 'react';\n` +
|
||||
`import MarkdownBlock from '@core/components/Markdown'\n` +
|
||||
`export default () => <MarkdownBlock source={${source}} siteConfig={${siteConfig}} />;`
|
||||
`import Markdown from '@theme/Markdown'\n` +
|
||||
`export default () => (
|
||||
<Markdown siteConfig={${siteConfig}}>
|
||||
{${content}}
|
||||
</Markdown>
|
||||
);`
|
||||
);
|
||||
|
||||
// return `export default () => <MarkdownBlock source={${source}} siteConfig={${siteConfig}} />`;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue