File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -103,11 +103,10 @@ const onAfterDataTransformation = (data) => {
103103
104104 if ( allAvailableComponents . length !== 0 ) {
105105 const imports = `import { ${ allAvailableComponents . join ( ', ' ) } } from '${ COMPONENTS_PATH } ';\n\n` ;
106- transformedData = imports + transformedData ;
107- // const isTitles = /---((?:\r?\n|\r)|.)+?---/.test(transformedData);
108- // transformedData = isTitles
109- // ? (transformedData.replace(/^(---((?:\s*\n)|.)+?---)/, `$1\n\n${imports}`) + "\n\n<Disqus />")
110- // : imports + transformedData;
106+ const isTitles = / - - - ( (?: \r ? \n | \r ) | .) + ?- - - / . test ( transformedData ) ;
107+ transformedData = isTitles
108+ ? ( transformedData . replace ( / ^ ( - - - ( (?: \s * \n ) | .) + ?- - - ) / , `$1\n\n${ imports } ` ) )
109+ : imports + transformedData ;
111110 }
112111
113112 if ( metaDescription ) {
You can’t perform that action at this time.
0 commit comments