Skip to content

Commit 64ac9ae

Browse files
committed
feat(markdown): rehype-highlight plugin for code blocks highlight and remark-emoji for emojis like this :emoji:
1 parent 40c2ab5 commit 64ac9ae

File tree

4 files changed

+100
-7
lines changed

4 files changed

+100
-7
lines changed

package-lock.json

Lines changed: 75 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
"html-webpack-plugin": "3.2.0",
6767
"pretty-quick": "1.7.0",
6868
"node-sass": "4.9.3",
69+
"rehype-highlight": "^2.2.0",
70+
"remark-emoji": "^2.0.2",
6971
"sass-loader": "7.1.0",
7072
"source-map-loader": "^0.2.4",
7173
"style-loader": "0.23.0",
@@ -134,6 +136,8 @@
134136
"node-sass": "4.9.3",
135137
"prettier": "1.14.3",
136138
"pretty-quick": "1.7.0",
139+
"rehype-highlight": "^2.2.0",
140+
"remark-emoji": "^2.0.2",
137141
"sass-loader": "7.1.0",
138142
"style-loader": "0.23.0",
139143
"webpack": "4.20.2",

src/webpack.config.common.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const webpack = require("webpack");
22
const convert = require("koa-connect");
33
const history = require("connect-history-api-fallback");
4+
const highlight = require("rehype-highlight");
5+
const emoji = require("remark-emoji");
46
const commonPaths = require("./paths");
57

68
module.exports = {
@@ -45,7 +47,18 @@ module.exports = {
4547
},
4648
{
4749
test: /\.md$/,
48-
loader: ["babel-loader", "@hugmanrique/react-markdown-loader"],
50+
use: [
51+
{
52+
loader: "babel-loader",
53+
},
54+
{
55+
loader: "@hugmanrique/react-markdown-loader",
56+
options: {
57+
rehypePlugins: [highlight],
58+
remarkPlugins: [emoji],
59+
},
60+
},
61+
],
4962
},
5063
],
5164
},

src/webpack.config.dev.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const HtmlWebpackPlugin = require("html-webpack-plugin");
2+
const webpack = require("webpack");
23
const commonPaths = require("./paths");
34

45
module.exports = {
@@ -38,6 +39,12 @@ module.exports = {
3839
new HtmlWebpackPlugin({
3940
template: commonPaths.templatePath,
4041
}),
42+
new webpack.HotModuleReplacementPlugin(),
4143
],
4244
devtool: "source-map",
45+
devServer: {
46+
compress: true,
47+
historyApiFallback: true,
48+
hot: true,
49+
},
4350
};

0 commit comments

Comments
 (0)