Skip to content

Commit

Permalink
format indented code blocks correctly (markdoc#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfix-stripe authored Sep 28, 2022
1 parent 399f80e commit 0bea68f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/formatter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,13 @@ Yes!
* Create your CNAME record
1. Click **Add record**.
\`\`\`json
{
"nested": "code block"
}
\`\`\`
1. Enter these values in the form that opens:
{% table %}
Expand Down Expand Up @@ -491,6 +498,12 @@ Yes!
- Create your CNAME record
1. Click **Add record**.
\`\`\`json
{
"nested": "code block"
}
\`\`\`
1. Enter these values in the form that opens:
{% table %}
Expand Down
3 changes: 1 addition & 2 deletions src/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ function* formatNode(n: Node, o: Options = {}) {
yield NL;
yield indent;
// TODO use formatChildren once we can differentiate inline from block tags within fences
yield n.attributes.content; // yield* formatChildren(n, no);
yield indent;
yield n.attributes.content.split(NL).join(NL + indent); // yield* formatChildren(n, no);
yield '```';
yield NL;
break;
Expand Down

0 comments on commit 0bea68f

Please sign in to comment.