feat(v2): truncate marker as blog option (#1706)

* feat(v2): allowed more as truncate marker

* feat(v2): blog support truncateMarker option

* feat(v2): blog support truncateMarker option
This commit is contained in:
陈杨文 2019-07-27 17:07:26 +08:00 committed by Endi
parent e38373ac9b
commit d17a1ea9e3
3 changed files with 16 additions and 6 deletions

View file

@ -31,6 +31,7 @@ const DEFAULT_OPTIONS = {
blogTagsPostsComponent: '@theme/BlogTagsPostsPage',
remarkPlugins: [],
rehypePlugins: [],
truncateMarker: /<!--\s*(truncate)\s*-->/, // string or regex
};
module.exports = function(context, opts) {
@ -340,7 +341,7 @@ module.exports = function(context, opts) {
},
configureWebpack(config, isServer, {getBabelLoader, getCacheLoader}) {
const {rehypePlugins, remarkPlugins} = options;
const {rehypePlugins, remarkPlugins, truncateMarker} = options;
return {
module: {
rules: [
@ -359,6 +360,9 @@ module.exports = function(context, opts) {
},
{
loader: path.resolve(__dirname, './markdownLoader.js'),
options: {
truncateMarker,
},
},
].filter(Boolean),
},