From c803023df09912926af7e526d73d6672b57fe0cd Mon Sep 17 00:00:00 2001 From: Sonal Saldanha Date: Sun, 28 Oct 2018 12:05:26 +0530 Subject: [PATCH] Ignore header while setting line numbers Use the `firstLineNumber` property to ignore headers while setting line numbers. --- extension/src/json-viewer/highlight-content.js | 1 + extension/src/json-viewer/options/defaults.js | 1 + 2 files changed, 2 insertions(+) diff --git a/extension/src/json-viewer/highlight-content.js b/extension/src/json-viewer/highlight-content.js index d3b45472..2717d820 100644 --- a/extension/src/json-viewer/highlight-content.js +++ b/extension/src/json-viewer/highlight-content.js @@ -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; diff --git a/extension/src/json-viewer/options/defaults.js b/extension/src/json-viewer/options/defaults.js index 88c3e291..ae93884c 100644 --- a/extension/src/json-viewer/options/defaults.js +++ b/extension/src/json-viewer/options/defaults.js @@ -14,6 +14,7 @@ module.exports = { structure: { readOnly: true, lineNumbers: true, + firstLineNumber: 1, lineWrapping: true, foldGutter: true, tabSize: 2,