From c73ad4684f15e1d9201b12d4aa0b280c4e2e5f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Pieczy=C5=84ski?= Date: Fri, 23 Aug 2019 13:55:39 +0200 Subject: [PATCH 1/3] Retain empty lines Fixes: #16994 --- packages/gatsby-remark-prismjs/src/directives.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/gatsby-remark-prismjs/src/directives.js b/packages/gatsby-remark-prismjs/src/directives.js index c07f8699bd206..e801bc05855fb 100644 --- a/packages/gatsby-remark-prismjs/src/directives.js +++ b/packages/gatsby-remark-prismjs/src/directives.js @@ -154,7 +154,12 @@ module.exports = function highlightLineRange(code, highlights = []) { }) .map(line => { if (line.highlight) { - line.code = highlightWrap(line.code) + + // use non-breakable space to retain empty line in source listing + // as it is important when both line highlight and line numbering are used. + line.code + ? (line.code = highlightWrap(line.code)) + : (line.code = highlightWrap(" ")) } return line }) From f511cfa8775cfcaaf7940a1c0f5ac5c6361aac04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Pieczy=C5=84ski?= Date: Wed, 16 Oct 2019 10:18:08 +0200 Subject: [PATCH 2/3] Remove comments from directives.js Remove comments that made prettier angry --- packages/gatsby-remark-prismjs/src/directives.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/gatsby-remark-prismjs/src/directives.js b/packages/gatsby-remark-prismjs/src/directives.js index e801bc05855fb..abf4c79b07145 100644 --- a/packages/gatsby-remark-prismjs/src/directives.js +++ b/packages/gatsby-remark-prismjs/src/directives.js @@ -154,9 +154,6 @@ module.exports = function highlightLineRange(code, highlights = []) { }) .map(line => { if (line.highlight) { - - // use non-breakable space to retain empty line in source listing - // as it is important when both line highlight and line numbering are used. line.code ? (line.code = highlightWrap(line.code)) : (line.code = highlightWrap(" ")) From 05b2fa34ecf8f176ed510fd40a888b587eab42bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Pieczy=C5=84ski?= Date: Sun, 20 Oct 2019 18:34:02 +0200 Subject: [PATCH 3/3] Formatting with prettier