This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,13 @@
We can use our local packages, in our documentation thanks to dune's mdx stanza:
```ocaml
# #require "pkg.public-lib";;
# Public_lib.x;;
- : int = 1
```
```ocaml
# #require "pkg2.public-lib2";;
# Public_lib2.x;;
- : int = 2
```

View file

@ -0,0 +1,4 @@
(mdx
(files README.md)
(deps (package pkg2))
(packages pkg))

View file

@ -0,0 +1,4 @@
(library
(name public_lib)
(public_name pkg.public-lib)
(modules public_lib))

View file

@ -0,0 +1,4 @@
(library
(name public_lib2)
(public_name pkg2.public-lib2)
(modules public_lib2))

View file

@ -0,0 +1,31 @@
Since version 0.2 the mdx stanza supports a more generic `deps` field.
A deprecation warning is raised if using the olf `packages` field.
$ cat >dune-project <<EOF
> (lang dune 3.0)
> (using mdx 0.2)
> (cram disable)
> EOF
$ dune runtest
File "dune", line 4, characters 1-15:
4 | (packages pkg))
^^^^^^^^^^^^^^
Warning: 'packages' was deprecated in version 0.2 of mdx extension to verify
code blocks in .md files.
But using the new field with the old stanza would fail
$ cat >dune-project <<EOF
> (lang dune 2.8)
> (using mdx 0.1)
> EOF
$ dune runtest
File "dune", line 3, characters 1-22:
3 | (deps (package pkg2))
^^^^^^^^^^^^^^^^^^^^^
Error: 'deps' is only available since version 0.2 of mdx extension to verify
code blocks in .md files. Please update your dune-project file to have (using
mdx 0.2).
[1]