Skip to content

Commit 2e6aee8

Browse files
committed
Improve manual
1 parent ad605a8 commit 2e6aee8

File tree

4 files changed

+22
-19
lines changed

4 files changed

+22
-19
lines changed

manual/debug.wiki

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@
22

33
== Use the right compiler flags
44
=== OCaml flags
5-
Make sure to use "-g" flags when compiling and linking ocaml bytecode.
5+
Make sure to use {{{-g}}} flags when compiling and linking ocaml bytecode.
66
Js_of_ocaml will attempt to preserve variable names.
77

88
=== Js_of_ocaml flags
9-
* [--pretty] - format the generated JavaScript in a readable way and try to keep OCaml variable names.
10-
* [--no-inline] - prevent function inlining.
11-
* [--debug-info] - annotate the JavaScript file with locations from the OCaml sources.
12-
* [--source-map] - enable source-map support
9+
* {{{--pretty}}} - format the generated JavaScript in a readable way and try to keep OCaml variable names.
10+
* {{{--no-inline}}} - prevent function inlining.
11+
* {{{--debug-info}}} - annotate the JavaScript file with locations from the OCaml sources.
12+
* {{{--source-map}}} - enable source-map support
1313
1414
== JavaScript stacktrace
15-
Js_of_ocaml can attach a JavaScript [Error] that embed the current
16-
stacktrace to an OCaml exception. The [Error] can be attached with
15+
Js_of_ocaml can attach a JavaScript {{{Error}}} that embed the current
16+
stacktrace to an OCaml exception. The {{{Error}}} can be attached with
1717
{{{Js.Js_error.attach_js_backtrace}}} and extracted using
1818
{{{Js.Js_error.of_exn}}}. Un-handled OCaml exception will throw any
19-
JavaScript [Error] attached to them, allowing the JS engine to display
19+
JavaScript {{{Error}}} attached to them, allowing the JS engine to display
2020
the stacktrace nicely.
2121

22-
Js_of_ocaml will attach an [Error] automatically when raising an OCaml
22+
Js_of_ocaml will attach an {{{Error}}} automatically when raising an OCaml
2323
exception (with {{{raise}}}, not with {{{raise_notrace}}}) if
2424
{{{Printexc.backtrace_status() = true}}} and either the environment
25-
variable [OCAMLRUNPARAM] is set with [b=1] or the program was compiled
26-
with [--enable with-js-error].
25+
variable {{{OCAMLRUNPARAM}}} is set with {{{b=1}}} or the program was compiled
26+
with {{{--enable with-js-error}}}.
2727

28-
Note that creating JavaScript [Error]s is costly and can degrade performance a lot.
28+
Note that creating JavaScript {{{Error}}}s is costly and can degrade performance a lot.
2929
This is the reason why such feature is not enabled by default.
3030

3131
== Breakpoint

manual/environment-variable.wiki

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
To resolve an environment variable, js_of_ocaml will perform the
44
following steps, in the given order:
55

6-
- If the variable was set at compile time with the [--setenv VAR] flag, return it.
7-
- If running nodejs and the variable is set in the process environment ([process.env]), return it.
8-
- If the variable is set in [globalThis.jsoo_env], return it. This can be used
6+
* If the variable was set at compile time with the {{{--setenv VAR}}} flag, return it.
7+
* If running nodejs and the variable is set in the process environment ({{{process.env}}}), return it.
8+
* If the variable is set in {{{globalThis.jsoo_env}}}, return it. This can be used
99
to set an environment variable inside a web-browser.
10-
- Return Not_found
10+
* Return Not_found

manual/overview.wiki

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Js_of_ocaml is composed of multiple packages:
2323
* js_of_ocaml-toplevel, lib and tools to build an ocaml toplevel to
2424
javascript.
2525

26+
There is also a compiler targeting WebAssembly provided by the
27+
wasm_of_ocaml package, see <<a_manual chapter="wasm_overview" |wasm_of_ocaml>>.
28+
2629
Note: All code examples in this manual use Js_of_ocaml's ppx syntax.
2730
It is, however, possible to use Js_of_ocaml purely as a compiler
2831
while using a different package (e.g. gen_js_api, brr) to
@@ -87,8 +90,8 @@ functions are optimized:
8790
Effect handlers are fully supported with the
8891
{{{--enable=effects}}} flag. Effect support is disabled by
8992
default for now since effects are not widely used at the moment and the
90-
generated code can be slower, larger and less readable. See the dedicated
91-
manual section about effects for details.
93+
generated code can be slower, larger and less readable. See the [[effects|dedicated
94+
manual section]] for details.
9295
9396
Data representation differs from the usual one. Most notably,
9497
integers are 32 bits (rather than 31 bits or 63 bits), which is their

manual/wasm_overview.wiki

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Wasm_of_ocaml is a compiler from OCaml bytecode programs to WebAssembly.
66
It provides an alternative way to run pure OCaml programs in JavaScript environments like browsers and Node.js.
77

8-
The compiler is provided by the wasm_of_ocaml-package. The <<a_manual chapter="overview" |Js_of_ocaml libraries>> are compatible with this compiler.
8+
The compiler is provided by the wasm_of_ocaml-compiler package. The <<a_manual chapter="overview" |Js_of_ocaml libraries>> are compatible with this compiler.
99

1010
== Installation
1111

0 commit comments

Comments
 (0)