[BREAKING] Rename Marked to MarkdownBlock (#162)

* Switch to Remarkable

* Clean up references to custom code blocks

* Remove valdiateDOMNesting warning

* Add syntax highlighting

* Add Reason support

* Breaking change: prismColor to codeColor, remove CompLibrary.Prism, expose hljs

* Completely remove Prism and associated CSS rules

* Support loading plugins and scripts

* Remove CSS rules, allowing Highlight.js theme to be used entirely

* Remove unnecessary webplayer script

* Rename Marked to MarkdownBlock

* Rename Marked to MarkdownBlock

* Remove Marked.js
This commit is contained in:
Héctor Ramos 2017-10-30 15:47:13 -07:00 committed by Joel Marcey
parent d26d263bd0
commit 09354ab738
10 changed files with 28 additions and 24 deletions

View file

@ -22,16 +22,16 @@ If you wish to use your own components inside the website folder, use `process.c
Docusaurus provides the following components in `CompLibrary`: Docusaurus provides the following components in `CompLibrary`:
### `CompLibrary.Marked` ### `CompLibrary.MarkdownBlock`
A React component that parses Markdown to html. A React component that parses markdown and renders to HTML.
Example: Example:
```jsx ```jsx
const Marked = CompLibrary.Marked; const MarkdownBlock = CompLibrary.MarkdownBlock;
<Marked>[Markdown syntax for a link](http://www.example.com)</Marked> <MarkdownBlock>[Markdown syntax for a link](http://www.example.com)</MarkdownBlock>
``` ```
### `CompLibrary.Container` ### `CompLibrary.Container`

View file

@ -8,7 +8,7 @@
const React = require("react"); const React = require("react");
const CompLibrary = require("../../core/CompLibrary.js"); const CompLibrary = require("../../core/CompLibrary.js");
const Marked = CompLibrary.Marked; /* Used to read markdown */ const MarkdownBlock = CompLibrary.MarkdownBlock; /* Used to read markdown */
const Container = CompLibrary.Container; const Container = CompLibrary.Container;
const GridBlock = CompLibrary.GridBlock; const GridBlock = CompLibrary.GridBlock;
@ -126,7 +126,7 @@ class Index extends React.Component {
style={{ textAlign: "center" }} style={{ textAlign: "center" }}
> >
<h2>Feature Callout</h2> <h2>Feature Callout</h2>
<Marked>These are features of this project</Marked> <MarkdownBlock>These are features of this project</MarkdownBlock>
</div> </div>
<Container padding={["bottom", "top"]} background="light"> <Container padding={["bottom", "top"]} background="light">

View file

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
const Marked = require("./Marked.js"); const MarkdownBlock = require("./MarkdownBlock.js");
const React = require("react"); const React = require("react");
// inner blog component for the article itself, without sidebar/header/footer // inner blog component for the article itself, without sidebar/header/footer
@ -28,12 +28,12 @@ class BlogPost extends React.Component {
content = content.split("<!--truncate-->")[0]; content = content.split("<!--truncate-->")[0];
return ( return (
<article className="post-content"> <article className="post-content">
<Marked>{content}</Marked> <MarkdownBlock>{content}</MarkdownBlock>
{hasSplit} {hasSplit}
</article> </article>
); );
} }
return <Marked>{content}</Marked>; return <MarkdownBlock>{content}</MarkdownBlock>;
} }
renderAuthorPhoto() { renderAuthorPhoto() {

View file

@ -5,13 +5,13 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
const Marked = require("./Marked.js"); const MarkdownBlock = require("./MarkdownBlock.js");
const Container = require("./Container.js"); const Container = require("./Container.js");
const GridBlock = require("./GridBlock.js"); const GridBlock = require("./GridBlock.js");
// collection of other components to provide to users // A collection of components to provide to users
module.exports = { module.exports = {
Marked: Marked, MarkdownBlock: MarkdownBlock,
Container: Container, Container: Container,
GridBlock: GridBlock GridBlock: GridBlock
}; };

View file

@ -6,7 +6,7 @@
*/ */
const React = require("react"); const React = require("react");
const Marked = require("./Marked.js"); const MarkdownBlock = require("./MarkdownBlock.js");
const translate = require("../server/translate.js").translate; const translate = require("../server/translate.js").translate;
@ -51,7 +51,7 @@ class Doc extends React.Component {
<h1>{this.props.title}</h1> <h1>{this.props.title}</h1>
</header> </header>
<article> <article>
<Marked>{this.props.content}</Marked> <MarkdownBlock>{this.props.content}</MarkdownBlock>
</article> </article>
</div> </div>
); );

View file

@ -8,7 +8,7 @@
const React = require("react"); const React = require("react");
const classNames = require("classnames"); const classNames = require("classnames");
const Marked = require("./Marked.js"); const MarkdownBlock = require("./MarkdownBlock.js");
class GridBlock extends React.Component { class GridBlock extends React.Component {
renderBlock(block) { renderBlock(block) {
@ -38,9 +38,9 @@ class GridBlock extends React.Component {
{topLeftImage} {topLeftImage}
<div className="blockContent"> <div className="blockContent">
{this.renderBlockTitle(block.title)} {this.renderBlockTitle(block.title)}
<Marked> <MarkdownBlock>
{block.content} {block.content}
</Marked> </MarkdownBlock>
</div> </div>
{bottomRightImage} {bottomRightImage}
</div> </div>
@ -73,9 +73,9 @@ class GridBlock extends React.Component {
if (title) { if (title) {
return ( return (
<h2> <h2>
<Marked> <MarkdownBlock>
{title} {title}
</Marked> </MarkdownBlock>
</h2> </h2>
); );
} else { } else {

View file

@ -5,12 +5,14 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
/* Marked component is used to parse markdown to html */ /**
* The MarkdownBlock component is used to parse markdown and render to HTML.
*/
const React = require('react'); const React = require('react');
const Remarkable = require('./Remarkable'); const Remarkable = require('./Remarkable');
class Marked extends React.Component { class MarkdownBlock extends React.Component {
render() { render() {
return ( return (
<Remarkable source={this.props.children} /> <Remarkable source={this.props.children} />
@ -18,4 +20,5 @@ class Marked extends React.Component {
} }
} }
module.exports = Marked; module.exports = MarkdownBlock;

View file

@ -239,7 +239,7 @@ function execute(port) {
if (metadata.layout && siteConfig.layouts[metadata.layout]) { if (metadata.layout && siteConfig.layouts[metadata.layout]) {
Doc = siteConfig.layouts[metadata.layout]({ Doc = siteConfig.layouts[metadata.layout]({
React, React,
Marked: require("../core/Marked.js") MarkdownBlock: require("../core/MarkdownBlock.js")
}); });
} }

View file

@ -8,9 +8,9 @@
const React = require("react"); const React = require("react");
const CompLibrary = require("../../core/CompLibrary.js"); const CompLibrary = require("../../core/CompLibrary.js");
const Marked = CompLibrary.Marked; /* Used to read markdown */
const Container = CompLibrary.Container; const Container = CompLibrary.Container;
const GridBlock = CompLibrary.GridBlock; const GridBlock = CompLibrary.GridBlock;
const MarkdownBlock = CompLibrary.MarkdownBlock; /* Used to read markdown */
const siteConfig = require(process.cwd() + "/siteConfig.js"); const siteConfig = require(process.cwd() + "/siteConfig.js");

View file

@ -71,4 +71,5 @@ const siteConfig = {
} }
}; };
module.exports = siteConfig; module.exports = siteConfig;