ocamlformat icon indicating copy to clipboard operation
ocamlformat copied to clipboard

Feature request: run ocamlformat on mld files

Open MisterDA opened this issue 4 years ago • 1 comments

I'm starting to write readmes and manuals for my opam packages written in mld, that odoc/odig pick up and render nicely. The documents typically contain embedded OCaml code in the form of snippets or examples:

{@ocaml[
let the = fun () -> begin
  (* ... *)
  end
]}

Could it be possible to have ocamlformat run on the embedded OCaml snippets? It would make them more readable for the end-reader of the documentation and for the author as well. Even better, ocamlformat could have full support of mld files since I believe is able to reformat documentation in OCaml source code, and do simple stuff such as break lines and reformat code snippets.

MisterDA avatar Dec 27 '21 20:12 MisterDA

~This should be handled with #1941, but in .mli files not .mld, don't hesitate to give some feedback for this PR. .mld is a different usecase though, I've opened https://github.com/realworldocaml/mdx/pull/361 but this probably needs to live outside of mdx to not depend on ocamlformat.~

~edit: here is the new PR: https://github.com/gpetiot/ocamlformat-mdx-blocks/pull/1~

edit: my bad, I didn't realize it was .mld and not .md, see #2008 instead

gpetiot avatar Jan 03 '22 13:01 gpetiot