Skip to content

Commit

Permalink
add notes
Browse files Browse the repository at this point in the history
  • Loading branch information
xeho91 committed Nov 6, 2024
1 parent 5739e0e commit a8e84dd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/mod.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,15 @@ class Printer {
if (skip_indent) this.#output += code;
else {
code = code.replace(/^(?=.+)/gm, this.#indent);
const rex = /`[^`].*[^`]*`/g;
this.#output += code.replace(rex, (match) => {
return match.replace(new RegExp(this.#indent, "g"), "");
});
this.#output += code.replace(
// NOTE: This temporary solution is supposed to remove auto-indentation from the content inside
// `TemplateLiteral`.
// Reference: https://github.com/storybookjs/addon-svelte-csf/issues/227
/`[^`].*[^`]*`/g,
(match) => {
return match.replace(new RegExp(this.#indent, "g"), "");
},
);
}
}

Expand Down

0 comments on commit a8e84dd

Please sign in to comment.