Skip to content

Commit

Permalink
Fixes #39: more compact markdown output
Browse files Browse the repository at this point in the history
Remove double empty lines after `</details>`.
  • Loading branch information
lukstafi committed Feb 17, 2024
1 parent e3aedef commit 51d2fc5
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 33 deletions.
4 changes: 3 additions & 1 deletion src/printbox-md/PrintBox_md.ml
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,10 @@ let pp c out b =
(fun _out sub -> loop ~no_block ~no_md ~prefix:subprefix sub)
out
@@ Array.to_list body;
(* Note: vlist and tree element separators move to a new line.
A non-html hlist or table as a parent would not produce correct results. *)
if c.Config.foldable_trees then
fprintf out "@,%s</details>@,%s@,%s" prefix prefix prefix
fprintf out "@,%s</details>@,%s" prefix prefix
| B.Link { uri; inner } ->
pp_print_string out "[";
loop ~no_block:true ~no_md ~prefix:(prefix ^ " ") inner;
Expand Down
2 changes: 0 additions & 2 deletions src/printbox-md/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,9 @@ Trees are rendered as:
- **are the details.**
</details>


</details>



### Tables

There is a special case carved out for Markdown syntax tables.
Expand Down
15 changes: 0 additions & 15 deletions test/test_md.expected
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,8 @@ Test foldable:
> - > subchild 3
> </details>
>
>
> </details>
>
>
- <details><summary></summary>

- <details><summary>[header 4]</summary>
Expand All @@ -204,14 +202,11 @@ Test foldable:
- `<nothing>`
</details>


- & \*\*subchild\*\* 4
</details>


</details>


- > <details><summary><code>header 5</code></summary>
>
> -
Expand All @@ -225,7 +220,6 @@ Test foldable:
>
> </details>
>
>
- > >
> > ```
> > a │looooooooooooooooooooooooo
Expand Down Expand Up @@ -257,7 +251,6 @@ Test foldable:
</details>



Test uniform tab=2, text tables:
<details><summary><code>┌────┐<br>
│root│<br>
Expand Down Expand Up @@ -345,14 +338,11 @@ Test uniform tab=2, text tables:
- `<nothing>`
</details>


- & \*\*subchild\*\* 4
</details>


</details>


-
```
┌───────────────────────┐
Expand Down Expand Up @@ -424,7 +414,6 @@ Test uniform tab=2, text tables:
</details>



Test single quote tab=2, text tables:
<details><summary><code>┌────┐<br>
│root│<br>
Expand Down Expand Up @@ -488,14 +477,11 @@ Test single quote tab=2, text tables:
- `<nothing>`
</details>


- & \*\*subchild\*\* 4
</details>


</details>


- `┌───────────────────────┐`
`│header 5 · · · · · · · │`
`│└─subchild 5 · · · · · │`
Expand Down Expand Up @@ -551,5 +537,4 @@ Test single quote tab=2, text tables:
</details>



The end.
15 changes: 0 additions & 15 deletions test/test_md.expected.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,8 @@ Test foldable:
> - > subchild 3
> </details>
>
>
> </details>
>
>
- <details><summary></summary>
- <details><summary>[header 4]</summary>
Expand All @@ -204,14 +202,11 @@ Test foldable:
- `<nothing>`
</details>
- & \*\*subchild\*\* 4
</details>
</details>
- > <details><summary><code>header 5</code></summary>
>
> -
Expand All @@ -225,7 +220,6 @@ Test foldable:
>
> </details>
>
>
- > >
> > ```
> > a │looooooooooooooooooooooooo
Expand Down Expand Up @@ -257,7 +251,6 @@ Test foldable:
</details>
Test uniform tab=2, text tables:
<details><summary><code>┌────┐<br>
│root│<br>
Expand Down Expand Up @@ -345,14 +338,11 @@ Test uniform tab=2, text tables:
- `<nothing>`
</details>
- & \*\*subchild\*\* 4
</details>
</details>
-
```
┌───────────────────────┐
Expand Down Expand Up @@ -424,7 +414,6 @@ Test uniform tab=2, text tables:
</details>
Test single quote tab=2, text tables:
<details><summary><code>┌────┐<br>
│root│<br>
Expand Down Expand Up @@ -488,14 +477,11 @@ Test single quote tab=2, text tables:
- `<nothing>`
</details>
- & \*\*subchild\*\* 4
</details>
</details>
- `┌───────────────────────┐`
`│header 5 · · · · · · · │`
`│└─subchild 5 · · · · · │`
Expand Down Expand Up @@ -551,5 +537,4 @@ Test single quote tab=2, text tables:
</details>
The end.

0 comments on commit 51d2fc5

Please sign in to comment.