",
},
],
diff --git a/packages/gatsby-remark-prismjs/src/__tests__/__snapshots__/highlight-code.js.snap b/packages/gatsby-remark-prismjs/src/__tests__/__snapshots__/highlight-code.js.snap
index 7829320580221..d741cd7491b34 100644
--- a/packages/gatsby-remark-prismjs/src/__tests__/__snapshots__/highlight-code.js.snap
+++ b/packages/gatsby-remark-prismjs/src/__tests__/__snapshots__/highlight-code.js.snap
@@ -1,9 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`highlight code and lines with PrismJS for language cpp 1`] = `
-"
-intsum(a, b){
-return a + b;
+"intsum(a, b){return a + b;}
"
`;
@@ -20,11 +18,8 @@ exports[`highlight code and lines with PrismJS for language jsx 1`] = `
render(){return(
-<div>
-<h1>Counter</h1>
-<p>current count: {this.state.count}</p>
-<buttononClick={()=>this.setState({ count:this.state.count +1})}>
- plus
+<div><h1>Counter</h1><p>current count: {this.state.count}</p>
+<buttononClick={()=>this.setState({ count:this.state.count +1})}> plus</button><buttononClick={()=>this.setState({ count:this.state.count -1})}> minus
diff --git a/packages/gatsby-remark-prismjs/src/__tests__/__snapshots__/highlight-line-range.js.snap b/packages/gatsby-remark-prismjs/src/__tests__/__snapshots__/highlight-line-range.js.snap
index b0eb94aad0543..da5f0b4180ffe 100644
--- a/packages/gatsby-remark-prismjs/src/__tests__/__snapshots__/highlight-line-range.js.snap
+++ b/packages/gatsby-remark-prismjs/src/__tests__/__snapshots__/highlight-line-range.js.snap
@@ -1,87 +1,50 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`highlighting a line range highlight-line highlights line 1`] = `
-" return \\"hello world\\"
-"
-`;
+exports[`highlighting a line range highlight-line highlights line 1`] = `" return \\"hello world\\""`;
-exports[`highlighting a line range highlight-next-line highlights correct line 1`] = `
-" return \\"hello world\\"
-"
-`;
+exports[`highlighting a line range highlight-next-line highlights correct line 1`] = `" return \\"hello world\\""`;
exports[`highlighting a line range highlight-range does not highlight and warns if range is invalid 1`] = `""`;
exports[`highlighting a line range highlight-range highlights correct lines 1`] = `
-" a = 1 + 1
-
- b = 2 + 2
-
- return \\"hello world\\"
-"
+" a = 1 + 1
+ b = 2 + 2
+ return \\"hello world\\""
`;
exports[`highlighting a line range highlight-range highlights until end of code block if ranges goes farther 1`] = `
-" a = 1 + 1
-
- b = 2 + 2
-
- return \\"hello world\\"
-
-}
-
-
-"
+" a = 1 + 1
+ b = 2 + 2
+ return \\"hello world\\"
+}
+"
`;
exports[`highlighting a line range highlight-start / highlight-end highlights correct lines 1`] = `
-" var a = \\"b\\"
-
- return a + \\"hello world\\"
-"
+" var a = \\"b\\"
+ return a + \\"hello world\\""
`;
exports[`highlighting a line range highlight-start / highlight-end highlights without end directive 1`] = `
-"var a = \\"b\\"
-
-return a + \\"hello world\\"
-
-
-"
+"var a = \\"b\\"
+return a + \\"hello world\\"
+"
`;
-exports[`highlighting a line range jsx comment highlights comment line 1`] = `
-"
-"
-`;
+exports[`highlighting a line range jsx comment highlights comment line 1`] = `""`;
-exports[`highlighting a line range jsx comment highlights comment line after Prism highlighting 1`] = `
-"<button>sup</button>
-"
-`;
+exports[`highlighting a line range jsx comment highlights comment line after Prism highlighting 1`] = `"<button>sup</button>"`;
exports[`highlighting a line range kitchen sink highlights multiple directives 1`] = `
-"import React, { Component } from \\"react\\"
-
- state = {
-
- count: 0,
-
- }
-
- count: state.count + 1,
-
- render() {
-
- const { count } = this.state
-
-
-
-
-"
-`;
-
-exports[`highlighting a line range yaml highlights yaml 1`] = `
-"- title: catorce
-"
-`;
+"import React, { Component } from \\"react\\"
+ state = {
+ count: 0,
+ }
+ count: state.count + 1,
+ render() {
+ const { count } = this.state
+
+"
+`;
+
+exports[`highlighting a line range yaml highlights yaml 1`] = `"- title: catorce"`;
diff --git a/packages/gatsby-remark-prismjs/src/highlight-line-range.js b/packages/gatsby-remark-prismjs/src/highlight-line-range.js
index 211d84e8d82e9..2c04883837a82 100644
--- a/packages/gatsby-remark-prismjs/src/highlight-line-range.js
+++ b/packages/gatsby-remark-prismjs/src/highlight-line-range.js
@@ -47,7 +47,7 @@ const stripComment = line =>
)
const wrap = line =>
- [``, `${line}\n`, ``].join(``)
+ [``, line, ``].join(``)
const wrapAndStripComment = line => wrap(stripComment(line))
@@ -149,7 +149,7 @@ module.exports = function highlightLineRange(code, highlights = []) {
const split = code.split(`\n`)
// If a highlight range is passed with the language declaration, e.g.
- // ```jsx{1, 3-4}
+ // ``jsx{1, 3-4}
// we only use that and do not try to parse highlight directives
if (highlights.length > 0) {
return split.map((line, i) => {