File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ module.exports = async function loader(content) {
2828 // use preset graph
2929 const presetGraph = JSON . parse ( fs . readFileSync ( graph , 'utf8' ) ) ;
3030
31- elementLabel = presetGraph . filter ( page => page . filePath === this . resourcePath ) [ 0 ] . label ;
31+ elementLabel = presetGraph . filter ( ( page ) => page . filePath === this . resourcePath ) [ 0 ] . label ;
3232 } else {
3333 // auto hash label
3434 const hash = crypto . createHash ( labelHash . algo ) ;
@@ -49,7 +49,7 @@ module.exports = async function loader(content) {
4949 } ;
5050
5151 parser . parse ( content , preset )
52- . then ( markdown => build ( markdown , defaults ) )
53- . then ( component => callback ( null , component ) )
52+ . then ( ( markdown ) => build ( markdown , defaults ) )
53+ . then ( ( component ) => callback ( null , component ) )
5454 . catch ( callback ) ;
5555} ;
Original file line number Diff line number Diff line change 1+ /* eslint-disable no-async-promise-executor */
12'use strict' ;
23
34const frontMatter = require ( 'front-matter' ) ;
@@ -20,20 +21,23 @@ function parseMarkdown(markdown, preset = {}) {
2021 const settings = preset . settings ? preset . settings : { } ;
2122
2223 try {
23- const parser = unified ( )
24+ unified ( )
2425 . use ( remarkParse , settings )
2526 . use ( remark2rehype , { allowDangerousHtml : true } )
2627 . use ( raw )
2728 . use ( rehypePrism )
2829 . use ( preset )
29- . use ( htmlRehype ) ;
30-
31- convertedHtml = String ( await parser . process ( markdown . body ) ) ;
30+ . use ( htmlRehype )
31+ . process ( markdown . body , ( err , file ) => {
32+ if ( err ) {
33+ // eslint-disable-next-line no-console
34+ console . log ( report ( err ) ) ;
35+ }
36+ convertedHtml = String ( file ) ;
37+ } ) ;
3238
3339 return resolve ( { html : convertedHtml , attributes : markdown . attributes } ) ;
3440 } catch ( err ) {
35- // eslint-disable-next-line no-console
36- console . log ( report ( err ) ) ;
3741 return reject ( err ) ;
3842 }
3943 } ) ;
You can’t perform that action at this time.
0 commit comments