Skip to content

Commit cac827a

Browse files
committed
Also allow "data-linenum='true'" to trigger line numbers instead of causing "NaN" to print as line numbers
1 parent 7ffad18 commit cac827a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tasks/build.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ grunt.registerHelper("syntax-highlight", function( options, callback ) {
125125
var $t = $(this),
126126
code = $t.html(),
127127
lang = $t.attr("data-lang") || getLanguageFromClass( $t.attr("class") ) || crudeHTMLcheck( code ),
128-
linenum = $t.attr("data-linenum") || 1,
129-
gutter = $t.attr("data-linenum") === undefined ? false : true,
128+
linenumAttr = $t.attr("data-linenum"),
129+
linenum = (linenumAttr === "true" ? 1 : linenumAttr) || 1,
130+
gutter = linenumAttr === undefined ? false : true,
130131
brush = nsh.getLanguage( lang ) || nsh.getLanguage( "js" ),
131132
highlighted = nsh.highlight( code, brush, {
132133
"first-line": linenum,

0 commit comments

Comments
 (0)