File tree Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 1
1
const fs = require ( 'fs' )
2
+ const path = require ( 'path' )
2
3
const hljs = require ( 'highlightjs' )
3
4
const marked = require ( 'marked' )
4
5
@@ -35,14 +36,17 @@ module.exports = {
35
36
extend ( config , { loaders } ) {
36
37
config . resolve . alias . vue = 'vue/dist/vue.common'
37
38
39
+ config . resolveLoader . alias = config . resolveLoader . alias || { }
40
+ config . resolveLoader . alias [ 'marked-loader' ] = path . join ( __dirname , './utils/marked-loader' )
41
+
38
42
config . devtool = 'source-map'
39
43
40
44
config . module . rules . push ( {
41
45
test : / \. m d $ / ,
42
46
use : [
43
47
{ loader : 'html-loader' } ,
44
48
{
45
- loader : 'markdown -loader' ,
49
+ loader : 'marked -loader' ,
46
50
options : {
47
51
renderer,
48
52
headerIds : true ,
Original file line number Diff line number Diff line change
1
+ // Based on https://github.com/peerigon/markdown-loader/
2
+ // Converts markdown files into HTML format
3
+ // Config options are passed directly to marked
4
+ // - https://marked.js.org/#/USING_ADVANCED.md#options
5
+
6
+ const marked = require ( 'marked' )
7
+ const { getOptions } = require ( 'loader-utils' )
8
+
9
+ module . exports = function ( markdown ) {
10
+ // merge params and default config
11
+ const options = getOptions ( this )
12
+ // Make results cacheable
13
+ this . cacheable ( )
14
+ // Pass our options
15
+ marked . setOptions ( options )
16
+ // Return the converted file as HTML
17
+ return marked ( markdown )
18
+ }
Original file line number Diff line number Diff line change 113
113
"highlightjs" : " ^9.12.0" ,
114
114
"html-loader" : " ^0.5.5" ,
115
115
"jest" : " ^23.6.0" ,
116
+ "loader-utils" : " ^1.2.3" ,
116
117
"lodash" : " ^4.17.11" ,
117
- "markdown-loader" : " ^4.0.0" ,
118
- "marked" : " ^0.5.2" ,
118
+ "marked" : " ^0.6.0" ,
119
119
"node-sass" : " ^4.11.0" ,
120
120
"nuxt-edge" : " ^2.4.0-25770819.0e9eca2f" ,
121
121
"postcss-cli" : " ^6.1.0" ,
You can’t perform that action at this time.
0 commit comments