⚠️ Oops! This page doesn't appear to define a type called _.
Edit

Interactive Code Snippets

If you put this in your doc-comments:

```reason
print_endline("Hello");
```

Then you get this, with full type-for-hover, and in-browser running & editing.

print_endline("Hello");
[@@@ocaml.ppx.context { cookies = [] }]
let _ = print_endline "Hello"

When you execute, will trap the console & display below (should also send to real console).

Displaying errors

```re
This is a syntax error
```
This is a syntax error
Parse Error: File "", line 1, characters 5-7: Error: 1392: syntax error, consider adding a `;' before
This is a syntax error
Parse Error: Unable to refmt code with a syntax error. The original error was File "", line 1, characters 5-7: Error: 1392: syntax error, consider adding a `;' before

If you intend to have a syntax error, add parse-fail to the header, like re;parse-fail. Other wise you'll get a big warning when you run docre.

```re
3 + "type error"
```
3 + "type error"
Type Error: File "", line 1, characters 4-16: Error: This expression has type string but an expression was expected of type int
[@@@ocaml.ppx.context { cookies = [] }]
let _ = 3 + "type error"
Type Error: File "", line 2, characters 12-24: Error: This expression has type string but an expression was expected of type int

Similarly, if you intend to have a type error, add type-fail to the header, like re;type-fail.

More fancy output options

# Hiding prefix & suffix lines

```
#let x = "this line will be hidden";
#let y = "this line will also be hidden";
let z = x ++ y; /* wow where did that come from */
# /* also this line will be hidden */
!#Js.log("And this line will be visible, but read-only at the end.");
```
let z = x ++ y; /* wow where did that come from */
Js.log("And this line will be visible, but read-only at the end.");
[@@@ocaml.ppx.context { cookies = [] }]
let x = "this line will be hidden"
let y = "this line will also be hidden"
let z = x ^ y
let _ = Js.log "And this line will be visible, but read-only at the end."

canvas Have a canvas

```canvas
Js.log("A shared canvas is created, and floats over to the right. The canvasId is available as 'sandboxId'.");
[@bs.val] external sandboxId: string = "";
```

shared(name) Share something

```shared(awesome)
let something = "A string I want to use later";
```
let something = "A string I want to use later";
[@@@ocaml.ppx.context { cookies = [] }]
let something = "A string I want to use later"

And then use it later:

```use(awesome)
Js.log(something);
```
/* Yay now this type checks */
Js.log(something);
[@@@ocaml.ppx.context { cookies = [] }]
let something = "A string I want to use later"
let _ = Js.log something

hide Hide a code block

Nice if you want a shared block that doesn't make sense on its own:

```hide
let x = 10;
```

Write the source in OCaml

```ml
Js.log "this was written in ocaml";
```
Js.log "this was written in ocaml";
Js.log("this was written in ocaml");

If you're seeing it in reason, toggle the syntax switch in the top right.

You can have code blocks default to ocaml syntax by passing the --ml flag.

Also, all snippets in ocamldoc comments (in ml files) will be assumed to be ocaml syntax.