realworldocaml / mdx

Execute code blocks inside your documentation
ISC License
268 stars 45 forks source link

Vendor odoc-parser #430

Closed jonludlam closed 1 year ago

jonludlam commented 1 year ago

This PR vendors odoc-parser into the repo. This helps prevent the use of mdx in odoc's tests. In this I've vendored the latest release of odoc-parser, but once ocaml/odoc#973 is merged we'll want to adjust the script to point at the odoc repo rather than the odoc-parser repo.

panglesd commented 1 year ago

to make it point to the odoc repo since the parser has been merged back.

More modification would be needed since the new AST has changed the code block node.

Moreover, one would want to use the new syntax for "output of code blocks". Indeed, it would fix a bug where an error in the execution leads to:

{[
  let f = 1 + "2"
]}```mdx-error
An expression of type int was expected, but got a string

which is not valid odoc code.
jonludlam commented 1 year ago

I think we should merge this as-is, release a version of mdx, then do the work to upgrade to the new parser API.

trefis commented 1 year ago

I agree with this plan.

gpetiot commented 1 year ago

Moreover, one would want to use the new syntax for "output of code blocks". Indeed, it would fix a bug where an error in the execution leads to:

{[
  let f = 1 + "2"
]}```mdx-error
An expression of type int was expected, but got a string

I had a look at it, did I miss something regarding the new syntax for the output of code blocks? this is not mentioned in the docs

panglesd commented 1 year ago

More info is available here: https://github.com/ocaml-doc/odoc-parser/pull/17

I don't know if the new syntax is documented in doco master's branch, but it's normal that it is not in the doc for the released version!