const USER_PATH = process . cwd ( ) ; const __target = `${ __dirname }/../../templates/target` ; import File from './file' ; let includeStyle = false ; export const appendHighlight = async ( source , scripts ) => { const docPath = `${ USER_PATH }/${ source }` ; const files = await File . readdir ( docPath ) ; let hljs = '' ; for ( const name of files ) { if ( name === 'highlight.js' ) { await File . exec ( `cp ${ docPath }/${ name } ${ __target }` ) ; hljs += `<script src="./highlight.js"></script>` ; } if ( name === 'highlight.css' ) { await File . exec ( `cp ${ docPath }/${ name } ${ __target }` ) ; includeStyle = true ; } } scripts = hljs + scripts ; return scripts ; } ; export const appendHighlightStyle = ( inlineHtml ) : string => { if ( ! includeStyle ) return inlineHtml ; return inlineHtml . replace ( '<!--<link rel="stylesheet" href="./highlight.css">-->' , '<link rel="stylesheet" href="./highlight.css">' ) ; } ;