From ca2ff14c7db510f84fadb45811257ec6cc3174e8 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Mon, 3 Feb 2025 21:58:23 +0100 Subject: [PATCH] Improve manual --- manual/debug.wiki | 22 +++++++++++----------- manual/environment-variable.wiki | 8 ++++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/manual/debug.wiki b/manual/debug.wiki index 71bc2b15e7..6c56a8b5d8 100644 --- a/manual/debug.wiki +++ b/manual/debug.wiki @@ -6,26 +6,26 @@ Make sure to use "-g" flags when compiling and linking ocaml bytecode. Js_of_ocaml will attempt to preserve variable names. === Js_of_ocaml flags - * [--pretty] - format the generated JavaScript in a readable way and try to keep OCaml variable names. - * [--no-inline] - prevent function inlining. - * [--debug-info] - annotate the JavaScript file with locations from the OCaml sources. - * [--source-map] - enable source-map support + * {{{--pretty}}} - format the generated JavaScript in a readable way and try to keep OCaml variable names. + * {{{--no-inline}}} - prevent function inlining. + * {{{--debug-info}}} - annotate the JavaScript file with locations from the OCaml sources. + * {{{--source-map}}} - enable source-map support == JavaScript stacktrace -Js_of_ocaml can attach a JavaScript [Error] that embed the current -stacktrace to an OCaml exception. The [Error] can be attached with +Js_of_ocaml can attach a JavaScript {{{Error}}} that embed the current +stacktrace to an OCaml exception. The {{{Error}}} can be attached with {{{Js.Js_error.attach_js_backtrace}}} and extracted using {{{Js.Js_error.of_exn}}}. Un-handled OCaml exception will throw any -JavaScript [Error] attached to them, allowing the JS engine to display +JavaScript {{{Error}}} attached to them, allowing the JS engine to display the stacktrace nicely. -Js_of_ocaml will attach an [Error] automatically when raising an OCaml +Js_of_ocaml will attach an {{{Error}}} automatically when raising an OCaml exception (with {{{raise}}}, not with {{{raise_notrace}}}) if {{{Printexc.backtrace_status() = true}}} and either the environment -variable [OCAMLRUNPARAM] is set with [b=1] or the program was compiled -with [--enable with-js-error]. +variable {{{OCAMLRUNPARAM}}} is set with {{{b=1}}} or the program was compiled +with {{{--enable with-js-error}}}. -Note that creating JavaScript [Error]s is costly and can degrade performance a lot. +Note that creating JavaScript {{{Error}}}s is costly and can degrade performance a lot. This is the reason why such feature is not enabled by default. == Breakpoint diff --git a/manual/environment-variable.wiki b/manual/environment-variable.wiki index e45e11b7fc..b528148fe2 100644 --- a/manual/environment-variable.wiki +++ b/manual/environment-variable.wiki @@ -3,8 +3,8 @@ To resolve an environment variable, js_of_ocaml will perform the following steps, in the given order: -- If the variable was set at compile time with the [--setenv VAR] flag, return it. -- If running nodejs and the variable is set in the process environment ([process.env]), return it. -- If the variable is set in [globalThis.jsoo_env], return it. This can be used +* If the variable was set at compile time with the [--setenv VAR] flag, return it. +* If running nodejs and the variable is set in the process environment ([process.env]), return it. +* If the variable is set in [globalThis.jsoo_env], return it. This can be used to set an environment variable inside a web-browser. -- Return Not_found \ No newline at end of file +* Return Not_found \ No newline at end of file