Refactor markdown rendering

pull/1657/head
Kamran Ahmed 5 years ago
parent 2b7350b5ab
commit 1e2f5d43ef
  1. 22
      components/guide-body/index.js
  2. 2
      components/md-renderer/index.js
  3. 0
      components/md-renderer/mdx-components/a.js
  4. 0
      components/md-renderer/mdx-components/blockquote.js
  5. 0
      components/md-renderer/mdx-components/heading.js
  6. 0
      components/md-renderer/mdx-components/iframe.js
  7. 0
      components/md-renderer/mdx-components/img.js
  8. 0
      components/md-renderer/mdx-components/index.js
  9. 0
      components/md-renderer/mdx-components/p.js
  10. 0
      components/md-renderer/mdx-components/pre.js
  11. 0
      components/md-renderer/mdx-components/table.js
  12. 5
      components/roadmap-summary/index.js
  13. 8
      pages/guides/[guide].js

@ -1,13 +1,21 @@
import { MDXProvider } from '@mdx-js/react';
import MdxComponents from 'components/mdx-components';
import MdRenderer from 'components/md-renderer'
import SharePage from 'components/share-page';
import { GuideBodyWrap } from './style';
const GuideBody = (props) => (
<MDXProvider components={ MdxComponents }>
const GuideBody = ({ guide }) => {
const GuideContent = require(`../../storage/guides/${guide.fileName}.md`).default;
return (
<GuideBodyWrap>
{ props.children }
<MdRenderer>
<GuideContent />
<SharePage
title={ guide.title }
url={ guide.url }
twitterUsername={ guide.author.twitter }
/>
</MdRenderer>
</GuideBodyWrap>
</MDXProvider>
);
);
};
export default GuideBody;

@ -1,5 +1,5 @@
import { MDXProvider } from '@mdx-js/react';
import MdxComponents from 'components/mdx-components';
import MdxComponents from './mdx-components';
const MdRenderer = (props) => (
<MDXProvider components={ MdxComponents }>

@ -5,6 +5,7 @@ import SharePage from 'components/share-page';
import { BadgeLink, BadgesList, DarkBadge, PrimaryBadge, SecondaryBadge } from 'components/badges';
import GuideBody from 'components/guide-body';
import siteConfig from "storage/site";
import MdRenderer from '../md-renderer';
const UpcomingGuide = require(`../../storage/guides/upcoming.md`).default;
@ -50,9 +51,9 @@ const RoadmapSummary = ({ roadmap }) => {
<Summary>
{
roadmap.upcoming && (
<GuideBody>
<MdRenderer>
<UpcomingGuide />
</GuideBody>
</MdRenderer>
)
}
{

@ -3,7 +3,6 @@ import GuideLayout from 'layouts/guide';
import { serverOnlyProps } from 'lib/server';
import GuideHeader from 'components/guide-header';
import GuideBody from 'components/guide-body';
import SharePage from 'components/share-page';
import GuideFooter from 'components/guide-footer';
import { getRequestedGuide } from 'lib/guide';
import Helmet from 'components/helmet';
@ -13,16 +12,11 @@ const Guide = ({ guide }) => {
return <Error statusCode={ 404 } />
}
const GuideContent = require(`../../storage/guides/${guide.fileName}.md`).default;
return (
<GuideLayout>
<Helmet title={ guide.title } description={ guide.description } />
<GuideHeader guide={ guide } />
<GuideBody>
<GuideContent />
<SharePage title={ guide.title } url={ guide.url } twitterUsername={ guide.author.twitter } />
</GuideBody>
<GuideBody guide={ guide } />
<GuideFooter guide={ guide } />
</GuideLayout>
);

Loading…
Cancel
Save