Skip to content

Commit 9fefc3d

Browse files
committed
Remove out of date content and naming
Signed-off-by: Nathan Rebours <[email protected]>
1 parent 7f931b6 commit 9fefc3d

File tree

1 file changed

+6
-89
lines changed

1 file changed

+6
-89
lines changed

README.md

Lines changed: 6 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[![Build Status](https://img.shields.io/endpoint?url=https%3A%2F%2Fci.ocamllabs.io%2Fbadge%2Frealworldocaml%2Fmdx%2Fmain&logo=ocaml)](https://ci.ocamllabs.io/github/realworldocaml/mdx)
22

3-
## mdx -- executable code blocks inside documentation
3+
## MDX
44

5-
`mdx` allows to execute code blocks inside markdown and mli documentation
5+
MDX allows to execute code blocks inside markdown and mli documentation
66
to help keeping them up to date.
77

88
Use the
@@ -178,7 +178,7 @@ with a padding of 3:
178178
10
179179
```
180180

181-
`ocaml-mdx` will also consider exit codes when the syntax `[<exit code>]`is used:
181+
MDX will also consider exit codes when the syntax `[<exit code>]`is used:
182182

183183
```sh
184184
$ exit 1
@@ -190,7 +190,7 @@ of success).
190190

191191
#### OCaml Code
192192

193-
`ocaml-mdx` interprets OCaml fragments. It understands _normal_ code fragments and
193+
MDX interprets OCaml fragments. It understands _normal_ code fragments and
194194
_toplevel_ code fragments (starting with a `#` sign and optionally ending with
195195
`;;`). Arbitrary whitespace padding is supported, at long as it stays
196196
consistent within a code block.
@@ -211,7 +211,8 @@ Here is an examples of toplevel OCaml code:
211211
```
212212

213213
### File sync
214-
`mdx` is also capable of including content from files in fenced code blocks
214+
215+
MDX is also capable of including content from files in fenced code blocks
215216
using the label `file`. OCaml files can be sliced using named blocks:
216217

217218
```ocaml
@@ -234,38 +235,6 @@ Non-OCaml files can also be read and included in a block:
234235
```
235236
However, part splitting is only supported for OCaml files.
236237

237-
### Pre-processing
238-
239-
`ocaml-mdx pp` allows to transform a markdown file into a valid
240-
OCaml file, which can be passed to OCaml using the `-pp`
241-
option.
242-
243-
For instance, given the following `file.md` document:
244-
245-
```ocaml
246-
# print_endline "42"
247-
42
248-
```
249-
250-
Can be compiled and executed using:
251-
252-
```sh
253-
$ ocamlc -pp 'ocaml-mdx pp' -impl file.md -o file.exe
254-
$ ./file.exe
255-
42
256-
```
257-
258-
This can be automated using `dune`:
259-
260-
```
261-
(rule
262-
((targets (file.ml))
263-
(deps (file.md))
264-
(action (with-stdout-to ${@} (run ocaml-mdx pp ${<})))))
265-
266-
(executable ((name file)))
267-
```
268-
269238
### Tests
270239

271240
#### Cram Tests
@@ -294,51 +263,6 @@ To execute OCaml code and toplevel fragments, uses `ocaml-mdx test <file.md>`.
294263
If the output is not consistent with what is expected
295264
`<file.md>.corrected` is generated.
296265

297-
#### Integration with Dune
298-
299-
To test that the code blocks of `file.md` stay consistent, one can use
300-
dune's `mdx` stanza:
301-
302-
```
303-
(mdx
304-
(files file.md))
305-
```
306-
307-
This allows to test the consistency of a markdown file using the normal dev
308-
workflow:
309-
310-
```
311-
$ dune runtest
312-
```
313-
314-
will display a diff of the output if something has changed. For instance:
315-
316-
```
317-
$ dune runtest
318-
------ file.md
319-
++++++ file.md.corrected
320-
File "file.md", line 23, characters 0-1:
321-
|
322-
|```sh
323-
-| $ for i in `seq 1 3`; do echo $i; done
324-
+| $ for i in `seq 1 4`; do echo $i; done
325-
| 1
326-
| 2
327-
| 3
328-
+| 4
329-
|```
330-
```
331-
332-
And the changes can then be accepted using:
333-
334-
```
335-
$ dune promote
336-
```
337-
338-
For further details about the mdx stanza you should read the
339-
[according section](https://dune.readthedocs.io/en/latest/dune-files.html#mdx-since-2-4)
340-
in the dune documentation.
341-
342266
#### Non-deterministic Tests
343267

344268
**Non-deterministic Outputs**
@@ -458,10 +382,3 @@ Those variables are then available in the subsequent blocks
458382
bar
459383
- : unit = ()
460384
```
461-
462-
### Sections
463-
464-
It is possible to test or execute only a subset of the file using
465-
sections using the `--section` option (short name is `-s`). For
466-
instance `ocaml-mdx pp -s foo` will only consider the section matching the
467-
perl regular expression `foo`.

0 commit comments

Comments
 (0)