const visit = require ( `unist-util-visit` ) ; const parseLineNumberRange = require ( `./parse-line-number-range` ) ; const highlightCode = require ( `./highlight-code` ) ; module . exports = ( { markdownAST } ) => { visit ( markdownAST , `code` , node => { let language = node . lang ; let { splitLanguage , highlightLines , path , nocopy } = parseLineNumberRange ( language ) ; language = splitLanguage ; let preCssClassLanguage = `none` ; if ( language ) { language = language . toLowerCase ( ) ; preCssClassLanguage = language ; } const pathString = path ? ` path="${ path }"` : '' ; const copyString = ` nocopy="${ nocopy }"` ; node . type = `html` ; node . value = `<div class="gatsby-highlight">
      <pre class="language-${ preCssClassLanguage }" ${ pathString } ${ copyString }><code>${ highlightCode ( language , node . value , highlightLines ) }</code></pre>
      </div>` ; } ) ; } ;