-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
If I do this:
console.log(endent`
hello
\`\`\`json
${endent.pretty({ a: 1, b: 2, c: { foo: 3, bar: 4 } })}
\`\`\`
world
`)Or this:
const myJson = JSON.stringify({ a: 1, b: 2, c: { foo: 3, bar: 4 } })
console.log(endent`
hello
\`\`\`json
${myJson}
\`\`\`
world
`)I get this poorly-formatted output:
hello
```json
{
"a": 1,
"b": 2,
"c": {
"foo": 3,
"bar": 4
}
}
```
world
But I expect this:
hello
```json
{
"a": 1,
"b": 2,
"c": {
"foo": 3,
"bar": 4
}
}
```
world
However, if I put some text before my object:
console.log(endent`
hello
\`\`\`json
REMOVE_ME${endent.pretty({ a: 1, b: 2, c: { foo: 3, bar: 4 } })}
\`\`\`
world
`)It formats everything correctly (but then I need to remove the REMOVE_ME bit in a separate step):
hello
```json
REMOVE_ME{
"a": 1,
"b": 2,
"c": {
"foo": 3,
"bar": 4
}
}
```
world
I was going to file this over at https://github.com/zhouhanseng/endent but you have issues disabled there.
MartinCura
Metadata
Metadata
Assignees
Labels
No labels