Skip to content

Commit e9daeef

Browse files
committed
added
1 parent 1cf3175 commit e9daeef

File tree

10 files changed

+38
-2
lines changed

10 files changed

+38
-2
lines changed

docs/SUMMARY.md

100644100755
File mode changed.

docs/chapter-1/README.md

100644100755
File mode changed.

docs/chapter-1/something.md

100644100755
File mode changed.

docs/chapter-2/README.md

100644100755
File mode changed.

docs/chapter-2/something.md

100644100755
File mode changed.

docs/chapter-3/README.md

100644100755
File mode changed.

docs/chapter-3/something.md

100644100755
File mode changed.

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"start": "webpack-dev-server --mode development ",
99
"dev": "webpack --mode development --output ./dist/leaf.js",
1010
"build": "webpack --mode production --output ./dist/leaf.js",
11-
"docs-build":"gitbook build docs/ dist/docs",
11+
"docs-build": "gitbook build docs/ dist/docs",
1212
"predeploy": "npm run build",
1313
"deploy": "gh-pages -d dist"
1414
},
@@ -34,9 +34,11 @@
3434
"babel-loader": "^8.0.2",
3535
"css-loader": "^1.0.0",
3636
"docpress": "0.7.4",
37+
"file-loader": "^3.0.1",
3738
"gh-pages": "^2.0.1",
3839
"html-loader": "^0.5.5",
3940
"html-webpack-plugin": "^3.2.0",
41+
"json-loader": "^0.5.7",
4042
"mini-css-extract-plugin": "^0.4.2",
4143
"react": "^16.6.0",
4244
"react-dom": "^16.6.0",
@@ -46,7 +48,10 @@
4648
},
4749
"dependencies": {
4850
"bootstrap": "^4.1.3",
51+
"front-matter-loader": "^0.2.0",
4952
"jquery": "^3.3.1",
53+
"markdown-loader": "^4.0.0",
54+
"react-markdown": "^4.0.6",
5055
"reactstrap": "^6.5.0"
5156
},
5257
"docpress": {

src/App.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,30 @@ import { Button } from 'reactstrap';
44
import Navigation from './Components/Navigation';
55
import Main from './Components/Main';
66
import Herocontent from './Components/Herocontent';
7+
import ReactMarkdown from 'react-markdown';
8+
import AppMarkdown from '../README.md';
79

810
class App extends React.Component {
911
constructor(props){
1012
super(props);
1113
this.state = {
12-
count : 0
14+
count : 5,
15+
markdown: ''
1316
}
1417
this.increment = this.increment.bind(this);
1518
this.decrement = this.decrement.bind(this);
1619
}
1720

21+
componentDidMount() {
22+
fetch('../README.md')
23+
.then((resp) => resp.text())
24+
.then(data => {
25+
this.setState(
26+
{ markdown: data }
27+
);
28+
});
29+
}
30+
1831
increment() {
1932
this.setState(
2033
{count : this.state.count+1}
@@ -28,10 +41,12 @@ class App extends React.Component {
2841
}
2942

3043
render() {
44+
const { markdown } = this.state;
3145
return (
3246
<div>
3347
<Navigation />
3448
<Herocontent />
49+
<ReactMarkdown source={markdown} />
3550
<Main />
3651
</div>
3752
);

webpack.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const HtmlWebPackPlugin = require("html-webpack-plugin");
22
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
3+
34
module.exports = {
45
module: {
56
rules: [
@@ -19,6 +20,21 @@ module.exports = {
1920
}
2021
]
2122
},
23+
{
24+
test: /\.md$/,
25+
use: [
26+
{
27+
loader: "html-loader"
28+
},
29+
{
30+
loader: "markdown-loader",
31+
options: {
32+
pedantic: true,
33+
renderer
34+
}
35+
}
36+
]
37+
},
2238
{
2339
test: /\.css$/,
2440
use: [MiniCssExtractPlugin.loader, "css-loader"]

0 commit comments

Comments
 (0)