Skip to content

Commit

Permalink
Doc: Unwanted break before a unwrapped code span (#2378)
Browse files Browse the repository at this point in the history
In `wrap-docstrings=false` mode, the uneeded box around code spans cause
a break.
  • Loading branch information
Julow committed Jun 27, 2023
1 parent 8abe317 commit 8a50af7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
3 changes: 1 addition & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@

### Changes

- Preserve empty lines in doc-comments (#2379, @Julow)
- Escape less in doc-comments when possible (#2376, #2377, @Julow)
- Improve formatting of doc-comments (#2376, #2377, #2379, #2378, @Julow)
- Disable reporting of deprecated alerts while formatting code blocks (#2373, @Julow)
- Improve indentation of `as`-patterns (#2359, @Julow)
- Restore short form for first-class modules: `((module M) : (module S))` is formatted as `(module M : S)`) (#2280, #2300, @gpetiot, @Julow)
Expand Down
3 changes: 1 addition & 2 deletions lib/Fmt_odoc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ let fmt_code_block c s1 s2 =
fmt_code original )
| Some _ -> fmt_code original

let fmt_code_span s =
hovbox 0 (wrap "[" "]" (str (escape_balanced_brackets s)))
let fmt_code_span s = wrap "[" "]" (str (escape_balanced_brackets s))

let fmt_math_span s = hovbox 2 (wrap "{m " "}" (str s))

Expand Down
3 changes: 3 additions & 0 deletions test/passing/tests/js_source.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7953,3 +7953,6 @@ let _ =
;;

(* *)

(** xxxxxxxxxxxxxxxxxxxxxxxxxxx [xxxxxxx
xxxx] xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx [xxxxxxx] *)
3 changes: 3 additions & 0 deletions test/passing/tests/js_source.ml.ocp
Original file line number Diff line number Diff line change
Expand Up @@ -10187,3 +10187,6 @@ let _ =
;;

(* *)

(** xxxxxxxxxxxxxxxxxxxxxxxxxxx [xxxxxxx
xxxx] xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx [xxxxxxx] *)
3 changes: 3 additions & 0 deletions test/passing/tests/js_source.ml.ref
Original file line number Diff line number Diff line change
Expand Up @@ -10187,3 +10187,6 @@ let _ =
;;

(* *)

(** xxxxxxxxxxxxxxxxxxxxxxxxxxx [xxxxxxx
xxxx] xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx [xxxxxxx] *)

0 comments on commit 8a50af7

Please sign in to comment.