11'use strict' ;
22
3- var walk = require ( '../walk' ) ,
4- path = require ( 'path' ) ,
5- hljs = require ( 'highlight.js' ) ;
6-
7- /**
8- * Create a highlighter function that transforms strings of code
9- * into strings of HTML with highlighting tags.
10- *
11- * @param {boolean } auto whether to automatically detect a language
12- * @returns {Function } highlighter function
13- */
14- function highlightString ( auto ) {
15- return function ( example ) {
16- if ( auto ) {
17- return hljs . highlightAuto ( example || '' ) . value ;
18- }
19- return hljs . highlight ( 'js' , example || '' ) . value ;
20- } ;
21- }
22-
23- /**
24- * Highlights the contents of the `example` tag.
25- * @name highlight
26- * @param {Object } comment parsed comment
27- * @param {Object } [options] options
28- * @return {Object } comment with highlighted code
29- */
30- function highlight ( comment , options ) {
31- var hljsOptions = options . hljs || { } ;
32- hljs . configure ( hljsOptions ) ;
33-
34- if ( comment . examples ) {
35- comment . examples = comment . examples . map ( highlightString ( hljsOptions . highlightAuto ) ) ;
36- }
37-
38- return comment ;
39- }
3+ var path = require ( 'path' ) ;
404
415/**
426 * Formats documentation as HTML.
@@ -50,7 +14,6 @@ function highlight(comment, options) {
5014 */
5115module . exports = function makeHTML ( comments , options , callback ) {
5216 options = options || { } ;
53- comments = walk ( comments , highlight , options ) ;
5417 var theme = require ( 'documentation-theme-default' ) ;
5518 if ( options . theme ) {
5619 theme = require ( path . resolve ( process . cwd ( ) , options . theme ) ) ;
0 commit comments