Skip to content

Commit

Permalink
fix formatting for tags within fences (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfix-stripe committed Sep 21, 2022
1 parent 2314d78 commit 542ef4e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/formatter.test.ts
Expand Up @@ -488,4 +488,26 @@ Yes!
check(source, expected);
stable(expected);
});

it('fences with block level tags', () => {
const source = `{% tab %}
\`\`\`json {% filename="package.json" %}
{
"dependencies": {
...
{% highlight type="remove" %}
"beta": "1.2.3",
{% /highlight %}
{% highlight type="add" %}
"main": "1.2.4",
{% /highlight %}
...
}
}
\`\`\`
{% /tab %}
`;

check(source, source);
});
});
3 changes: 2 additions & 1 deletion src/formatter.ts
Expand Up @@ -185,7 +185,8 @@ function* formatNode(n: Node, o: Options = {}) {
yield* formatAnnotations(n);
yield NL;
yield indent;
yield* formatChildren(n, no);
// TODO use formatChildren once we can differentiate inline from block tags within fences
yield n.attributes.content; // yield* formatChildren(n, no);
yield indent;
yield '```';
yield NL;
Expand Down

0 comments on commit 542ef4e

Please sign in to comment.