diff --git a/docs/printbox-ext-plot-example_Map.png b/docs/printbox-ext-plot-example_Map.png new file mode 100644 index 0000000..aa2c364 Binary files /dev/null and b/docs/printbox-ext-plot-example_Map.png differ diff --git a/docs/printbox-ext-plot-example_half_moons.png b/docs/printbox-ext-plot-example_half_moons.png new file mode 100644 index 0000000..928e419 Binary files /dev/null and b/docs/printbox-ext-plot-example_half_moons.png differ diff --git a/docs/printbox-ext-plot-example_linear.png b/docs/printbox-ext-plot-example_linear.png new file mode 100644 index 0000000..5e3ac7b Binary files /dev/null and b/docs/printbox-ext-plot-example_linear.png differ diff --git a/docs/printbox-ext-plot-example_nested.png b/docs/printbox-ext-plot-example_nested.png new file mode 100644 index 0000000..2fe98f1 Binary files /dev/null and b/docs/printbox-ext-plot-example_nested.png differ diff --git a/dune-project b/dune-project index 020d80a..9e62143 100644 --- a/dune-project +++ b/dune-project @@ -31,7 +31,6 @@ Adds html output handling to the printbox package. Printbox allows to print nested boxes, lists, arrays, tables in several formats") (depends (printbox (= :version)) - (printbox-text (and (= :version) :with-test)) (odoc :with-test) (tyxml (>= 4.3)) (mdx (and (>= 1.4) :with-test)))) @@ -44,7 +43,6 @@ Adds Markdown output handling to the printbox package, with fallback to text and Printbox allows to print nested boxes, lists, arrays, tables in several formats") (depends (printbox (= :version)) (printbox-text (and (= :version))) - (printbox-html (and (= :version))) (odoc :with-test) (mdx (and (>= 1.4) :with-test)))) diff --git a/printbox-html.opam b/printbox-html.opam index f928763..08d4464 100644 --- a/printbox-html.opam +++ b/printbox-html.opam @@ -14,7 +14,6 @@ bug-reports: "https://github.com/c-cube/printbox/issues" depends: [ "dune" {>= "3.0"} "printbox" {= version} - "printbox-text" {= version & with-test} "odoc" {with-test} "tyxml" {>= "4.3"} "mdx" {>= "1.4" & with-test} diff --git a/printbox-md.opam b/printbox-md.opam index 0727a85..123136b 100644 --- a/printbox-md.opam +++ b/printbox-md.opam @@ -15,7 +15,6 @@ depends: [ "dune" {>= "3.0"} "printbox" {= version} "printbox-text" {= version} - "printbox-html" {= version} "odoc" {with-test} "mdx" {>= "1.4" & with-test} "odoc" {with-doc} diff --git a/src/printbox-ext-plot/README.md b/src/printbox-ext-plot/README.md new file mode 100644 index 0000000..c6c8042 --- /dev/null +++ b/src/printbox-ext-plot/README.md @@ -0,0 +1,290 @@ +# PrintBox extension for rendering plots over a 2D canvas + +See https://ocaml.org/p/printbox-ext-plot/latest/doc/PrintBox_ext_plot/index.html ([source](PrintBox_ext_plot.mli)). + +## Example: Map, Scatterbag + +[Source.](../../test/plotting.ml) + +The `specs` of this graph: + +```ocaml +Scatterbag + { points = [| ((0., 1.), B.line "Y"); ((1., 0.), B.line "X"); ((0.75, 0.75), B.line "M") |] }; +Map { callback = (fun (x, y) -> + let s = ((x ** 2.) +. (y ** 2.)) ** 0.5 in + B.line @@ + if s < 0.3 then " " + else if s < 0.6 then "." + else if s < 0.9 then "," + else if s < 1.2 then ":" + else ";"); } +``` + +Text rendering: + +```verbatim +┌──┬────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ 1│Y:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;│ +│ │::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;│ +│ │:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;;;;;;;;;;│ +│ │::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;;;;;;;│ +│ │,,,,,,,::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;;;;│ +│ │,,,,,,,,,,,,,,,,,,,,,,,:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;│ +│ │,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::::::::::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;;│ +│ │,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::::::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;│ +│ │,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;│ +│ │,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::::::::::::::::::::::::::::::::::::;;;;;;;;│ +│ │,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::::::::::::::M:::::::::::::::::::;;;;;;│ +│ │,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::::::::::::::::::::::::::::::::::;;;;│ +│ │,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::::::::::::::::::::::::::::::::;;│ +│ │,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::::::::::::::::::::::::::::::;│ +│ │,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::::::::::::::::::::::::::::│ +│ │,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::::::::::::::::::::::::::│ +│ │...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::::::::::::::::::::::::│ +│ │.....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::::::::::::::::::::::│ +│ │...........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::::::::::::::::::::│ +│y │...............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::::::::::::::::::│ +│ │...................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::::::::::::::::│ +│ │......................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::::::::::::::│ +│ │.........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::::::::::::::│ +│ │............................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::::::::::::│ +│ │..............................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::::::::::│ +│ │................................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::::::::::│ +│ │..................................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::::::::│ +│ │...................................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::::::::│ +│ │ ..........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::::::│ +│ │ ......................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::::::│ +│ │ ....................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::::│ +│ │ ..................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::::│ +│ │ .................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::::│ +│ │ ................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::::│ +│ │ ................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::│ +│ │ ...............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::│ +│ │ ..............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::│ +│ │ ..............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::::│ +│ │ ..............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,::::::::::│ +│ 0│ ..............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,:::::::::X│ +├──┼────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ │0 1│ +│ │ x │ +└──┴────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +HTML rendering image: +![A plot as above rendered with a white background](../../docs/printbox-ext-plot-example_Map.png) + +## Example: Line_plot_adaptive, Boundary_map + +[Source.](../../test/plotting_linear.ml) + +The `specs` of this graph: + +```ocaml +Line_plot_adaptive + { callback = (fun x -> sin x); content = B.line "#"; cache = Hashtbl.create 20 }; +Line_plot_adaptive + { callback = (fun x -> x ** 2.); content = B.line "%"; cache = Hashtbl.create 20 }; +Boundary_map + { content_false = B.line "."; content_true = B.line ","; callback = (fun (x, y) -> x > y) } +``` + +Text rendering: + +```verbatim +┌──┬────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ 1│...................................................................................................%│ +│ │.................................................................................................,%,│ +│ │..............................................................................................,,,%,,│ +│ │............................................................................................,,,,%,,,│ +│ │.........................................................................................,,,,,%%,,,,│ +│ │.......................................................................................,,,,,,%,,,,,,│ +│ │....................................................................................,,,,,,,,%,,,,,,,│ +│ │..................................................................................,,,,,,,,%%,,,,####│ +│ │...............................................................................,,,,,,,,,,%,#####,,,,│ +│ │.............................................................................,,,,,,,,,,####,,,,,,,,,│ +│ │..........................................................................,,,,,,,,,,###,,,,,,,,,,,,,│ +│ │........................................................................,,,,,,,,####%%,,,,,,,,,,,,,,│ +│ │.....................................................................,,,,,,,####,,,%,,,,,,,,,,,,,,,,│ +│ │...................................................................,,,,,,###,,,,,%%,,,,,,,,,,,,,,,,,│ +│ │................................................................,,,,,####,,,,,,,%,,,,,,,,,,,,,,,,,,,│ +│ │.............................................................,,,,,###,,,,,,,,,%%,,,,,,,,,,,,,,,,,,,,│ +│ │...........................................................,,,,###,,,,,,,,,,,%,,,,,,,,,,,,,,,,,,,,,,│ +│ │........................................................,,,,###,,,,,,,,,,,,%%,,,,,,,,,,,,,,,,,,,,,,,│ +│ │......................................................,,,###,,,,,,,,,,,,,%%,,,,,,,,,,,,,,,,,,,,,,,,,│ +│y │...................................................,,,###,,,,,,,,,,,,,,%%,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │.................................................,,###,,,,,,,,,,,,,,,,%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │..............................................,,###,,,,,,,,,,,,,,,,,%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │............................................,###,,,,,,,,,,,,,,,,,,%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │.........................................,###,,,,,,,,,,,,,,,,,,,%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │.......................................,##,,,,,,,,,,,,,,,,,,,,%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │....................................,###,,,,,,,,,,,,,,,,,,,,%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │..................................###,,,,,,,,,,,,,,,,,,,,,%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │...............................###,,,,,,,,,,,,,,,,,,,,,%%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │............................,##,,,,,,,,,,,,,,,,,,,,,,%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │..........................###,,,,,,,,,,,,,,,,,,,,,,%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │.......................,##,,,,,,,,,,,,,,,,,,,,,,%%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │.....................###,,,,,,,,,,,,,,,,,,,,,%%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │..................###,,,,,,,,,,,,,,,,,,,,,%%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │................##,,,,,,,,,,,,,,,,,,,,,%%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │.............###,,,,,,,,,,,,,,,,,,,,%%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │...........##,,,,,,,,,,,,,,,,,,,%%%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │........###,,,,,,,,,,,,,,,,,%%%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │......##,,,,,,,,,,,,,,,%%%%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │...###,,,,,,,,,,%%%%%%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ 0│###%%%%%%%%%%%%%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +├──┼────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ │0 1│ +│ │ x │ +└──┴────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +HTML rendering image: +![A plot as above rendered with a white background](../../docs/printbox-ext-plot-example_linear.png) + +### Example: nested boxes + +[Source.](../../test/plotting_nested.ml) + +The `specs` of this graph: + +```ocaml +Scatterbag { points = [| ((0.06, 0.95), reg_45); ((0.3, 0.3), reg_45) |] }; +Scatterbag { + points = [| + ((0., 1.), nice_unicode); + ((0.08, 0.9), nice_unicode); + ((1., 0.), for_3); + ((0.3, 0.3), nice_unicode); + ((0.75, 0.75), nice_unicode); + ((0.8, 0.8), nice_unicode); |]; }; +Map { + callback = (fun (x, y) -> + let s = ((x ** 2.) +. (y ** 2.)) ** 0.5 in + B.line + @@ + if s < 0.3 then " " + else if s < 0.6 then "." + else if s < 0.9 then "," + else if s < 1.2 then ":" + else ";"); } +``` + +Text rendering: + +```verbatim +┌──┬─────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ 1│┌────────────────────────────────────┐::::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; │ +│ ││nice unicode! 💪 │:::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;│ +│ │├────┌─────────┐─────────────────────┤:::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;;;;;;;;;; │ +│ ││┌───│123456789│┬───────────────────┐│::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;;;;;;; │ +│ │││oï ├─────────┤────────────────────────────┐::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;;;; │ +│ │││π/2│┌───────┐│code! 💪 │::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;│ +│ │││τ/4││ ....││────────────────────────────┤::::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;; │ +│ ││├───│├───────┤│───────┬───────────────────┐│::::::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;;; │ +│ │││ ││. ││d nums:│┌─────────────────┐││::::::::::::::::::::::::::::::::::┌──────────────────── │ +│ │││ │└───────┘│ ││┌───────────────┐│││,,::::::::::::::::::::::::::::::::│nice unicode! 💪 │ +│ │││ └─────────┘ │││┌─────────────┐││││,,,,,,:::::::::::::::::::::::┌───────────────────────── │ +│ │││ ├─│├──────────────┤│││sum=Σ_i a·xᵢ²│││││,,,,,,,,,::::::::::::::::::::│nice unicode! 💪 │ +│ │││ └─││ ││││————— │││││,,,,,,,,,,,,:::::::::::::::::├───────────────────────── │ +│ │││ ││ ││││1+1 │││││,,,,,,,,,,,,,,,::::::::::::::│┌──────────────┬───────── │ +│ │││ ││ 0 │││├─────────────┤││││,,,,,,,,,,,,,,,,,,:::::::::::││oï ωεird nums:│┌──────── │ +│ │││ ││ ├─1 ││││ Ōₒ│││││,,,,,,,,,,,,,,,,,,,,,::::::::││π/2 ││┌─────── │ +│ ││└─────││ └─ω ││││ À │││││,,,,,,,,,,,,,,,,,,,,,,,::::::││τ/4 │││┌────── │ +│ │└──────││ └─ω² │││└─────────────┘││││,,,,,,,,,,,,,,,,,,,,,,,,,::::│├──────────────┤│││sum=Σ_ │ +│ │.......││ ││└───────────────┘│││,,,,,,,,,,,,,,,,,,,,,,,,,,,::││ ││││————— │ +│y │.......││ │└─────────────────┘││,,,,,,,,,,,,,,,,,,,,,,,,,,,,,││ ││││1+1 │ +│ │.......│└──────────────┴───────────────────┘│,,,,,,,,,,,,,,,,,,,,,,,,,,,,,││ 0 │││├────── │ +│ │.......└────────────────────────────────────┘,,,,,,,,,,,,,,,,,,,,,,,,,,,,,││ ├─1 ││││ │ +│ │.........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,││ └─ω ││││ │ +│ │............................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,││ └─ω² │││└────── │ +│ │..............................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,││ ││└─────── │ +│ │................................................,,,,,,,,,,,,,,,,,,,,,,,,,,││ │└──────── │ +│ │..................................................,,,,,,,,,,,,,,,,,,,,,,,,│└──────────────┴───────── │ +│ │...................................................,,,,,,,,,,,,,,,,,,,,,,,└───────────────────────── │ +│ │ ..................┌─────────┐──────────────────────────┐,,,,,,,,,,,,,,,,,,::::::::::::::: │ +│ │ .............│123456789│de! 💪 │,,,,,,,,,,,,,,,,,,,,::::::::::::::│ +│ │ ..........├─────────┤──────────────────────────┤,,,,,,,,,,,,,,,,,,,,::::::::::::: │ +│ │ .......│┌───────┐│─────┬───────────────────┐│,,,,,,,,,,,,,,,,,,,,::::::::::::: │ +│ │ .....││ ....││nums:│┌─────────────────┐││,,,,,,,,,,,,,,,,,,,,,:::::::::::: │ +│ │ ...│├───────┤│ ││┌───────────────┐│││,,,,,,,,,,,,,,,,,,,,,:::::::::::: │ +│ │ ..││. ││ │││┌─────────────┐││││,,,,,,,,,,,,,,,,,,,,,,::::::::::: │ +│ │ .│└───────┘│─────┤│││sum=Σ_i a·xᵢ²│││││,,,,,,,,,,,,,,,,,,,,,,::::::::::: │ +│ │ └─────────┘ ││││————— │││││,,,,,,,,,,,,,,,,,,,,,,::::::::::: │ +│ │ ││ ││││1+1 │││││,,,,,,,,,,,,,,,,,,,,,,::::::::::: │ +│ │ ││ 0 │││├─────────────┤││││,,,,,,,,,,,,,,,,,,,,,,,:::::::::: │ +│ 0│ ││ ├─1 ││││ Ōₒ│││││,,,,,,,,,,,,,,,,,,,,,,,:::::::::( │ +├──┼─────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ │0 1│ +│ │ x │ +└──┴─────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +HTML rendering image: +![A plot as above rendered with a white background](../../docs/printbox-ext-plot-example_nested.png) + +## Example: Scatterplot + +[Source.](../../test/plotting_nested.ml) + +The `specs` of this graph: + +```ocaml +Scatterplot { points = points1; content = B.line "#" }; +Scatterplot { points = points2; content = B.line "%" }; +Boundary_map { content_false = B.line "."; content_true = B.line ","; + callback = fun (x, y) -> x > y } +``` + +Text rendering: + +```verbatim +┌───────┬────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ 1.09 │............................#.........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │.............................##.#...##..##..........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │......................########.###..#.....#.##.....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │.....................#.#..####.#...#.#..##.#...#.....#...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │..............#....##########.##....####.#...#.##.#.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │.............#.#####.###.#.#.#.##....###..##.##..##............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │.................#.#.#####.###...####..#..#.##.#.##.##.......,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │.........#....##..##.#..#..####.###......###..##.####.##.##.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │.........#.....#...###.##.##...#.#.#.#...#.....#.##.#####.,,#,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │..........###....#.#####.##.#..........#..#.....#####..###,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │.......#..#.#..#.#....#.....#................#..##...#.#,,#,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │......###.###..##.##..........................#....#..###,#,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │...#....#.###.##.##..........%.....................##,,#,#,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │......#######....#...................%%..........#.,,##,#,###,,,,,,,,,,,,,,,,,,,,,,,,,,,,%,,,,,%,,,,│ +│ │.##.##...##.#...##...............%...%............,,,,##,##,###,#,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ │.#.#.#.###.##.##.................%%...%.........,,,,,,,,###,,,##,,#,,,,,,,,,,,,,,,,,,,,,,,,,%%%,%%,,│ +│ │.....#.#..##...................%..%%%%%........,,,,,,,,,###,###,#,,,,,,,,,,,,,,,,,,,,,,,%%,,,%%%%,,,│ +│ │#.##.###.#.#................%.%...%.%%%......,,,,,,,,,#,,,#,,,,#,,#,,,,,,,,,,,,,,,,,,,,%,,,%,,%,,,,,│ +│ │#####.#...##.................%..%.%.....%...,,,,,,,,,,,,,#,,##,###,##,,,,,,,,,,,,,,,,,%%%,,,,%%,%,%,│ +│y │#.#.###.#.##.................%%.%.%%%..%...,,,,,,,,,,,,#,,,,,,,#,#,#,,,,,,,,,,,,,,,,,,%%,%,,,,,,%,%%│ +│ │##...###..#..................%%..%..%.%..,,,,,,,,,,,,,,,,##,,####,,,,#,,,,,,,,,,,,,,,%,,%,,,%,%,,%%,│ +│ │##......###..........................%%.%,%,,,,,,,,,,,,,,,,,,,,#,####,,,,,,,,,,,,,,,,,,,%%,,,,,%,%%,│ +│ │...#.#.###...................%..%%%%..%,,%,,,,,,,,,,,,,,,,##,,#######,,,,,,,,,,,,,,,,%%%,,,,,%,%,,,,│ +│ │......##.......................%...%.%%%,,,,,,,,,,,,,,,,,#,#,#,,,,,,#,,,,,,,,,,,,,,,,,,%,,%%,,,%%%,,│ +│ │....#..#...........................%,%,,%,,%,,,,,,,,,,,,,,,,#,,,,,,#,,,,,,,,,,,,,,,%,%%%%,,%%,,%,,,,│ +│ │........##.......................%,%%,,,%,%,,,,,,,,,,,,,,,,,,,#,,##,,,,,,,,,,,,,,,%%,,,%,,%%%,%,,,,,│ +│ │#.#............................%.,%,,%,,%%,,,,%%,,,,,,,,,#,,#,,,,,#,#,,,,,,,,,,,,,,,,%%%,%%,,,,,,,,,│ +│ │.#...#.........................,%%%,,%%%%%,%,,,,,,,,,,,,,,,,,#,,,,#,,,,,,,,,,%,,,,,%%%%,%,%,,,%,,,,,│ +│ │..............................,,,,,,,%,,%%%,,,%,%%%,%,,,,#,,,,,,,,,,,,,,,,,,,,%,%,,%,%%,%,%%,,%,,,,,│ +│ │............................,,,,,,%,%%%%%,%,%,%,%,,,,,,%,,,,,,,,,,,,,,,,,,,,,,%%,,%%,%,%,%,,,,%,,,,,│ +│ │...........................,,,,,,,,%,,,%%%%%,%%%,,,,,,,%,,,,,,,,,,,,,,,,%,%%,,%,%%%%%,%%,,,,,,,,,,,,│ +│ │.........................,,,,,,,,,,,,,,,,%,,,,,%%%%%,%,%,%%,,,,,,,,,,%,%%%%%%,%,,%,,,,,,,,,,,,,,,,,,│ +│ │........................,,,,,,,,,,,,%,,,%,%%,%,,,,,,,%,,%%,,%%,%,,,%%%%%%%,,%,%,%,,,,,%%,,,,,,,,,,,,│ +│ │.......................,,,,,,,,,,,,,,,%,,%,%%,%%%,,,,%,%%%,%%,,,%,%%,%,%,%%%,,%%%%%,,,,,,%,,,,,,,,,,│ +│ │.....................,,,,,,,,,,,,,,,,,,%%%%,%,,%,,,,,,,%%%,,%,,%%%%,%%,,,%,%,,%%,,%,,,,,,,,,,,,,,,,,│ +│ │....................,,,,,,,,,,,,,,,,,,,,,,,,,%,,%%,,%,%,%,%%,%%,,,%,,,%,%%,,,%%%,,,%%%,,,,,,,,,,,,,,│ +│ │..................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,%,,%%%,,%%%%,,%%%%,,,%%,%%%%%,,,,,,%,,,,,,,,,,,,,,│ +│ │.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,%%%,,,,,,,,%%%%%%,%%,%,,%%,%,,,,%,,,,,,,,,,,,,,,,,,,│ +│ │...............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,%,%%,%%%,%%%,,%%%%,,,%%,,,,,,,,,,,,,,,,,,,,,,,,,,│ +│ -0.794│..............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,%,,,,,,%,,,,,%,,,%,,,,%%,,,,,,,,,,,,,,,,,,,,,,,,,│ +├───────┼────────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ │-1.25 2.1│ +│ │ x │ +└───────┴────────────────────────────────────────────────────────────────────────────────────────────────────┘ +``` + +HTML rendering image: +![A plot as above rendered with a white background](../../docs/printbox-ext-plot-example_half_moons.png) diff --git a/src/printbox-md/PrintBox_md.ml b/src/printbox-md/PrintBox_md.ml index 99f0b16..4a2a365 100644 --- a/src/printbox-md/PrintBox_md.ml +++ b/src/printbox-md/PrintBox_md.ml @@ -8,7 +8,6 @@ module Config = struct | Code_quote type t = { - tables: [ `Text | `Html ]; vlists: [ `Line_break | `List | `As_table ]; hlists: [ `Minimal | `As_table ]; foldable_trees: bool; @@ -20,7 +19,6 @@ module Config = struct let default = { - tables = `Text; vlists = `List; hlists = `Minimal; foldable_trees = false; @@ -32,7 +30,6 @@ module Config = struct let uniform = { - tables = `Html; vlists = `Line_break; hlists = `As_table; foldable_trees = true; @@ -42,8 +39,6 @@ module Config = struct tab_width = 4; } - let html_tables c = { c with tables = `Html } - let text_tables c = { c with tables = `Text } let vlists x c = { c with vlists = x } let hlists x c = { c with hlists = x } let foldable_trees c = { c with foldable_trees = true } @@ -386,16 +381,12 @@ let pp c out b = if code_block then fprintf out "@,%s```@,%s" prefix prefix; pp_print_string out sty_post | B.Frame { sub = fb; _ } -> - (match c.Config.frames, c.Config.tables, no_block with - | `As_table, `Html, _ -> - (* Don't indent in case there's an embedded multiline preformatted text. *) - PrintBox_html.pp ~flush:false ~indent:false () out b; - if not no_md then fprintf out "@,%s@,%s" prefix prefix - | `As_table, `Text, _ -> + (match c.Config.frames, no_block with + | `As_table, _ -> let style = B.Style.preformatted in let l = break_lines [ PrintBox_text.to_string_with ~style:false b ] in loop ~no_block ~no_md ~prefix (B.lines_with_style style l) - | _, _, true -> + | _, true -> (* E.g. in a first Markdown table cell, "> " would mess up rendering. *) fprintf out "[%a]" (fun _out -> loop ~no_block ~no_md ~prefix:(prefix ^ " ")) @@ -487,28 +478,10 @@ let pp c out b = row; if i < n_rows - 1 then fprintf out "@,%s" prefix) rows - | B.Grid (_, _) when c.Config.tables = `Html && String.length prefix = 0 -> - PrintBox_html.pp ~flush:false ~indent:(not no_block) () out b; - if not no_md then fprintf out "@,%s@,%s" prefix prefix | B.Grid (_, _) -> - (match c.Config.tables with - | `Text -> - let style = B.Style.preformatted in - let l = break_lines [ PrintBox_text.to_string_with ~style:false b ] in - loop ~no_block ~no_md ~prefix (B.lines_with_style style l) - | `Html -> - let table = - PrintBox_html.( - if no_block then - to_string - else - to_string_indent) - b - in - let lines = break_lines [ table ] in - pp_print_list - ~pp_sep:(fun out () -> if not no_block then fprintf out "@,%s" prefix) - pp_print_string out lines); + let style = B.Style.preformatted in + let l = break_lines [ PrintBox_text.to_string_with ~style:false b ] in + loop ~no_block ~no_md ~prefix (B.lines_with_style style l); if not no_md then fprintf out "@,%s@,%s" prefix prefix | B.Tree (_extra_indent, header, [||]) -> loop ~no_block ~no_md ~prefix header diff --git a/src/printbox-md/PrintBox_md.mli b/src/printbox-md/PrintBox_md.mli index 30f557a..71a61b2 100644 --- a/src/printbox-md/PrintBox_md.mli +++ b/src/printbox-md/PrintBox_md.mli @@ -23,12 +23,6 @@ module Config : sig val uniform : t (** The configuration that leads to more lightweight and uniform rendering. *) - val html_tables : t -> t - (** Output tables via {!PrintBox_html}. Already the case for the {!uniform} config. *) - - val text_tables : t -> t - (** Output tables via {!PrintBox_text}. Already the case for the {!default} config. *) - val vlists : [ `Line_break | `List | `As_table ] -> t -> t (** How to output {!PrintBox.vlist} boxes, i.e. single-column grids. - [`Line_break]: when the {!PrintBox.vlist} has bars, it puts a quoted horizontal rule diff --git a/src/printbox-md/README.md b/src/printbox-md/README.md index bde9aa1..cca8df0 100644 --- a/src/printbox-md/README.md +++ b/src/printbox-md/README.md @@ -32,25 +32,16 @@ The   `` `Minimal ``   style for horizontal boxes simply puts all entr or if \`Bars are set, | by the | vertical dash. -
- - - - - -
It only works when
all the elements fit
logically speaking,
on a single line.
-
+ +``` +It only works when │logically speaking,│on a single line. +all the elements fit│ │ +``` -
- - - - - -
Otherwise, the fallback behavior is as if
`As_table
was used to configure horizontal boxes.
-
+ +`` Otherwise, the fallback behavior is as if`As_tablewas used to configure horizontal boxes. `` @@ -98,14 +89,6 @@ to separate the entries (here with style \`Line_break). - inside Markdown. -- And suprisingly it works even better -- - when tables are configured - -
to fallback on
- - - - HTML -- but it doesn't work on GitHub Preview. -- (GitHub ignores styles on \ and \ tags.) - ### Trees Trees   are rendered as: @@ -134,27 +117,19 @@ Header|cells |[must be] |bold. Rows |[must be]|single |line. [Only]|then |**we get**|a Markdown table. -
- - - - - - - - - - - - - -
Tables
that meet
neither
of:
-
Markdown's native
-
restrictions,
special cases:
hlist
-                                           vlist
End up
as either
of the fallbacks:
printbox-text
-                                           printbox-html
-
-
+ +``` +Tables │that meet │┌───────┐ │of: + │ ││neither│ │ + │ │└───────┘ │ +───────────────────┼─────────────┼──────────────┼───────────── +┌─────────────────┐│restrictions,│special cases:│hlist +│Markdown's native││ │ │vlist +└─────────────────┘│ │ │ +───────────────────┼─────────────┼──────────────┼───────────── +End up │as │the fallback: │printbox-text +``` + diff --git a/src/printbox-md/dune b/src/printbox-md/dune index a56abd8..7d6da8e 100644 --- a/src/printbox-md/dune +++ b/src/printbox-md/dune @@ -4,7 +4,7 @@ (wrapped false) (modules PrintBox_md) (flags :standard -w +a-3-4-44-29 -safe-string) - (libraries printbox printbox-text printbox-html)) + (libraries printbox printbox-text)) (executable (name readme) diff --git a/src/printbox-md/readme.ml b/src/printbox-md/readme.ml index 19d57e8..9bdb526 100644 --- a/src/printbox-md/readme.ml +++ b/src/printbox-md/readme.ml @@ -101,7 +101,7 @@ let () = let () = print_endline MD.( - to_string Config.(html_tables default) + to_string Config.default @@ B.( hlist ~bars:true [ @@ -113,7 +113,7 @@ let () = let () = print_endline MD.( - to_string Config.(html_tables @@ hlists `As_table default) + to_string Config.(hlists `As_table default) @@ B.( hlist ~bars:false [ @@ -217,23 +217,6 @@ let () = line "inside Markdown."; ])) -let () = - print_endline - MD.( - to_string Config.(html_tables @@ table_frames @@ vlists `List default) - @@ B.( - vlist ~bars:false - [ - line "And suprisingly it works even better"; - vlist ~bars:false - [ - line "when tables are configured"; - frame @@ line "to fallback on"; - line "HTML -- but it doesn't work on GitHub Preview."; - ]; - line "(GitHub ignores styles on
and tags.)"; - ])) - let () = print_endline {|### Trees |} @@ -311,7 +294,7 @@ let () = let () = print_endline MD.( - to_string Config.(html_tables default) + to_string Config.default @@ B.( let bold = text_with_style Style.bold in let code = text_with_style Style.preformatted in @@ -331,8 +314,8 @@ let () = ]; [ line "End up"; - line "as either"; - line "of the fallbacks:"; - code "printbox-text\nprintbox-html"; + line "as"; + line "the fallback:"; + code "printbox-text"; ]; ])) diff --git a/test/test_md.expected b/test/test_md.expected index 8249493..6eb9831 100644 --- a/test/test_md.expected +++ b/test/test_md.expected @@ -72,11 +72,19 @@ Test default: Test uniform unfolded: -
root
+``` +┌────┐ +│root│ +└────┘ +``` --
child 1
- +- + ``` + ┌───────┐ + │child 1│ + └───────┘ + ``` - `child 2` - line 1 @@ -87,8 +95,12 @@ Test uniform unfolded: a row 2.1 a row 2.2 -
a row 3
+ ``` + ┌───────┐ + │a row 3│ + └───────┘ + ``` - b row 1 > --- @@ -96,70 +108,126 @@ Test uniform unfolded: b row 2.2 > --- **b row 3** --
- - - - - -
a longiiish column 1
a longiiish column 2
a longiiish column 3
-
a longiiish column 4
-
+- + ``` + a longiiish column 1a longiiish column 2┌────────────────────┐a longiiish column 4 + │a longiiish column 3│ + └────────────────────┘ + ``` --
- - - - - - -
b longiiish column 1
b longiiish column 2
b longiiish column 3
b longiiish column 4
-
-
+- + ``` + b longiiish column 1│b longiiish column 2│b longiiish column 3│┌────────────────────┐ + │ │ ││b longiiish column 4│ + │ │ │└────────────────────┘ + ``` --
c row 1
c row 2.1
c row 2.2
c row 3
--
  • header 3
    • subchild 3
+- + ``` + ┌─────────┐ + │c row 1 │ + ├─────────┤ + │c row 2.1│ + │c row 2.2│ + ├─────────┤ + │c row 3 │ + └─────────┘ + ``` +- + ``` + ┌──────────────────┐ + │──┬────────┐ │ + │ │header 3│ │ + │ ├────────┘ │ + │ └─┬──────────┐ │ + │ │subchild 3│ │ + │ └──────────┘ │ + └──────────────────┘ + ``` - - -
header 4
- + - + ``` + ┌────────┐ + │header 4│ + └────────┘ + ``` - \ - `` - & \*\*subchild\*\* 4 --
header 5
  • subchild 5
    -  body 5
    -    subbody 5
    -	one tab end of sub 5
    -end of 5
- - --
a
looooooooooooooooooooooooo
oonng
bx
x
y
1
2
?
x
y
10
20
+- + ``` + ┌───────────────────────┐ + │header 5 │ + │└─subchild 5 │ + │ body 5 │ + │ subbody 5 │ + │ one tab end of sub 5 │ + │ end of 5 │ + └───────────────────────┘ + ``` +- + ``` + ┌──────────────────────────────────┐ + │┌─────┬──────────────────────────┐│ + ││a │looooooooooooooooooooooooo││ + ││ │oonng ││ + │├─────┼──────────────────────────┤│ + ││bx │ ┌─┬─┐ ││ + ││ │ │x│y│ ││ + ││ │ ├─┼─┤ ││ + ││ │ │1│2│ ││ + ││ │ └─┴─┘ ││ + │├─────┼──────────────────────────┤│ + ││ │ ││ + ││ │ x │y ││ + ││ ? │ ──┼── ││ + ││ │ 10│20 ││ + ││ │ ││ + │└─────┴──────────────────────────┘│ + └──────────────────────────────────┘ + ``` --
- - - - - - - - - - - -
header 1
header 2
header 3
cell 1.1
cell 1.2
cell 1.3
cell 2.1
cell 2.2
cell 2.3
-
+- + ``` + header 1 │header 2 │┌────────┐ + │ ││header 3│ + │ │└────────┘ + ──────────┼──────────┼────────── + cell 1.1 │┌────────┐│cell 1.3 + ││cell 1.2││ + │└────────┘│ + ──────────┼──────────┼────────── + ┌────────┐│cell 2.2 │cell 2.3 + │cell 2.1││ │ + └────────┘│ │ + ``` --
header 1
header 2
header 3
cell 1.1
cell 1.2
cell 1.3
cell 2.1
cell 2.2
cell 2.3
+- + ``` + ┌──────────┬──────────┬──────────┐ + │header 1 │header 2 │┌────────┐│ + │ │ ││header 3││ + │ │ │└────────┘│ + ├──────────┼──────────┼──────────┤ + │cell 1.1 │┌────────┐│cell 1.3 │ + │ ││cell 1.2││ │ + │ │└────────┘│ │ + ├──────────┼──────────┼──────────┤ + │┌────────┐│cell 2.2 │cell 2.3 │ + ││cell 2.1││ │ │ + │└────────┘│ │ │ + └──────────┴──────────┴──────────┘ + ``` Test foldable: @@ -255,7 +323,7 @@ Test foldable: -Test uniform tab=2, text tables: +Test uniform tab=2:
┌────┐
│root│
└────┘
@@ -418,7 +486,7 @@ Test uniform tab=2, text tables:
-Test single quote tab=2, text tables: +Test single quote tab=2:
┌────┐
│root│
└────┘
diff --git a/test/test_md.expected.md b/test/test_md.expected.md index 8249493..6eb9831 100644 --- a/test/test_md.expected.md +++ b/test/test_md.expected.md @@ -72,11 +72,19 @@ Test default: Test uniform unfolded: -
root
+``` +┌────┐ +│root│ +└────┘ +``` --
child 1
- +- + ``` + ┌───────┐ + │child 1│ + └───────┘ + ``` - `child 2` - line 1 @@ -87,8 +95,12 @@ Test uniform unfolded: a row 2.1 a row 2.2 -
a row 3
+ ``` + ┌───────┐ + │a row 3│ + └───────┘ + ``` - b row 1 > --- @@ -96,70 +108,126 @@ Test uniform unfolded: b row 2.2 > --- **b row 3** --
- - - - - -
a longiiish column 1
a longiiish column 2
a longiiish column 3
-
a longiiish column 4
-
+- + ``` + a longiiish column 1a longiiish column 2┌────────────────────┐a longiiish column 4 + │a longiiish column 3│ + └────────────────────┘ + ``` --
- - - - - - -
b longiiish column 1
b longiiish column 2
b longiiish column 3
b longiiish column 4
-
-
+- + ``` + b longiiish column 1│b longiiish column 2│b longiiish column 3│┌────────────────────┐ + │ │ ││b longiiish column 4│ + │ │ │└────────────────────┘ + ``` --
c row 1
c row 2.1
c row 2.2
c row 3
--
  • header 3
    • subchild 3
+- + ``` + ┌─────────┐ + │c row 1 │ + ├─────────┤ + │c row 2.1│ + │c row 2.2│ + ├─────────┤ + │c row 3 │ + └─────────┘ + ``` +- + ``` + ┌──────────────────┐ + │──┬────────┐ │ + │ │header 3│ │ + │ ├────────┘ │ + │ └─┬──────────┐ │ + │ │subchild 3│ │ + │ └──────────┘ │ + └──────────────────┘ + ``` - - -
header 4
- + - + ``` + ┌────────┐ + │header 4│ + └────────┘ + ``` - \ - `` - & \*\*subchild\*\* 4 --
header 5
  • subchild 5
    -  body 5
    -    subbody 5
    -	one tab end of sub 5
    -end of 5
- - --
a
looooooooooooooooooooooooo
oonng
bx
x
y
1
2
?
x
y
10
20
+- + ``` + ┌───────────────────────┐ + │header 5 │ + │└─subchild 5 │ + │ body 5 │ + │ subbody 5 │ + │ one tab end of sub 5 │ + │ end of 5 │ + └───────────────────────┘ + ``` +- + ``` + ┌──────────────────────────────────┐ + │┌─────┬──────────────────────────┐│ + ││a │looooooooooooooooooooooooo││ + ││ │oonng ││ + │├─────┼──────────────────────────┤│ + ││bx │ ┌─┬─┐ ││ + ││ │ │x│y│ ││ + ││ │ ├─┼─┤ ││ + ││ │ │1│2│ ││ + ││ │ └─┴─┘ ││ + │├─────┼──────────────────────────┤│ + ││ │ ││ + ││ │ x │y ││ + ││ ? │ ──┼── ││ + ││ │ 10│20 ││ + ││ │ ││ + │└─────┴──────────────────────────┘│ + └──────────────────────────────────┘ + ``` --
- - - - - - - - - - - -
header 1
header 2
header 3
cell 1.1
cell 1.2
cell 1.3
cell 2.1
cell 2.2
cell 2.3
-
+- + ``` + header 1 │header 2 │┌────────┐ + │ ││header 3│ + │ │└────────┘ + ──────────┼──────────┼────────── + cell 1.1 │┌────────┐│cell 1.3 + ││cell 1.2││ + │└────────┘│ + ──────────┼──────────┼────────── + ┌────────┐│cell 2.2 │cell 2.3 + │cell 2.1││ │ + └────────┘│ │ + ``` --
header 1
header 2
header 3
cell 1.1
cell 1.2
cell 1.3
cell 2.1
cell 2.2
cell 2.3
+- + ``` + ┌──────────┬──────────┬──────────┐ + │header 1 │header 2 │┌────────┐│ + │ │ ││header 3││ + │ │ │└────────┘│ + ├──────────┼──────────┼──────────┤ + │cell 1.1 │┌────────┐│cell 1.3 │ + │ ││cell 1.2││ │ + │ │└────────┘│ │ + ├──────────┼──────────┼──────────┤ + │┌────────┐│cell 2.2 │cell 2.3 │ + ││cell 2.1││ │ │ + │└────────┘│ │ │ + └──────────┴──────────┴──────────┘ + ``` Test foldable: @@ -255,7 +323,7 @@ Test foldable:
-Test uniform tab=2, text tables: +Test uniform tab=2:
┌────┐
│root│
└────┘
@@ -418,7 +486,7 @@ Test uniform tab=2, text tables:
-Test single quote tab=2, text tables: +Test single quote tab=2:
┌────┐
│root│
└────┘
diff --git a/test/test_md.ml b/test/test_md.ml index abac1ef..d86a825 100644 --- a/test/test_md.ml +++ b/test/test_md.ml @@ -99,21 +99,15 @@ let () = print_endline "Test foldable:" let () = print_endline @@ PrintBox_md.(to_string Config.(foldable_trees default)) b -let () = print_endline "Test uniform tab=2, text tables:" - -let () = - print_endline - @@ PrintBox_md.(to_string Config.(text_tables @@ tab_width 2 uniform)) b - -let () = print_endline "Test single quote tab=2, text tables:" +let () = print_endline "Test uniform tab=2:" +let () = print_endline @@ PrintBox_md.(to_string Config.(tab_width 2 uniform)) b +let () = print_endline "Test single quote tab=2:" let () = print_endline @@ PrintBox_md.( to_string - Config.( - text_tables @@ tab_width 2 - @@ multiline_preformatted Code_quote uniform)) + Config.(tab_width 2 @@ multiline_preformatted Code_quote uniform)) b let () = print_endline "The end."