Skip to content

Commit

Permalink
Ignore header while setting line numbers
Browse files Browse the repository at this point in the history
Use the `firstLineNumber` property to ignore headers while setting line
numbers.
  • Loading branch information
ssonal committed Oct 28, 2018
1 parent 69d3cdc commit c803023
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions extension/src/json-viewer/highlight-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function oversizedJSON(pre, options, outsideViewer) {

function prependHeader(options, outsideViewer, jsonText) {
if (!outsideViewer && options.addons.prependHeader) {
options.structure.firstLineNumber = options.structure.firstLineNumber - 3
var header = "// " + timestamp() + "\n";
header += "// " + document.location.href + "\n\n";
jsonText = header + jsonText;
Expand Down
1 change: 1 addition & 0 deletions extension/src/json-viewer/options/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
structure: {
readOnly: true,
lineNumbers: true,
firstLineNumber: 1,
lineWrapping: true,
foldGutter: true,
tabSize: 2,
Expand Down

0 comments on commit c803023

Please sign in to comment.