Bug Report Checklist
Expected
Interpolated expressions should pass through unmodified. A template like:
const value = "a\\tb"; // string contains: a\tb (literal backslash + t, NOT a tab)
const result = dedent`x: ${value}`;
should produce x: a\tb. The interpolated value is unchanged, just like a regular template literal.
Actual
The \t inside the interpolated value gets converted to a real tab character. result is x: ab.
This also affects \n, \r, \0, \xHH, \uHHHH, etc. inside interpolated values.
Additional Info
Introduced in 1.7.2. The new .replace() chain in the escapeSpecialCharacters block runs on the fully assembled result string (static parts + interpolated values combined), so it transforms escape sequences that originated from interpolated expressions too.
Minimal reproduction:
const dedent = require("dedent"); // 1.7.2
const value = "a\\tb";
const result = dedent`x: ${value}`;
console.log(result); // x: a b
console.log("Has tab?", result.includes("\t")); // true
Bug Report Checklist
mainbranch of the repository.Expected
Interpolated expressions should pass through unmodified. A template like:
should produce
x: a\tb. The interpolated value is unchanged, just like a regular template literal.Actual
The \t inside the interpolated value gets converted to a real tab character. result is x: ab.
This also affects \n, \r, \0, \xHH, \uHHHH, etc. inside interpolated values.
Additional Info
Introduced in 1.7.2. The new .replace() chain in the escapeSpecialCharacters block runs on the fully assembled result string (static parts + interpolated values combined), so it transforms escape sequences that originated from interpolated expressions too.
Minimal reproduction: