Skip to content

Commit

Permalink
Use ocaml syntax highlighting for reason.
Browse files Browse the repository at this point in the history
  • Loading branch information
Drup committed Mar 6, 2020
1 parent 90ffb73 commit 12492dc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/manual-wiki/jsx.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ opam install tyxml-jsx

This syntax should be familiar to most Reason users:

<<code language="reason"|
<<code language="ocaml"|
# open Tyxml;
# let intro = <span id="hello"> "Hello!" </span>;
Expand All @@ -27,7 +27,7 @@ The quotations will use the {{{Html}}} and {{{Svg}}} module that are available i

We can also build list of elements:

<<code language="reason"|
<<code language="ocaml"|
# let nice_picture = <> <p>"picture: "</p> <Html.svg> svgpath </Html.svg> </> ;
let nice_picture: list(Tyxml_html.elt([> `P | `Svg ])) =
[<p>picture: </p>,
Expand All @@ -36,15 +36,15 @@ let nice_picture: list(Tyxml_html.elt([> `P | `Svg ])) =

We can nest various elements and use spreads:

<<code language="reason"|
<<code language="ocaml"|
# let content = <> intro <div class_="content"> ...nice_picture </div> </>;
let content: list(Tyxml_html.elt([> `Div | `Span ])) =
[<span id="hello">Hello!</span>,
<div class="content"><p>picture: </p><svg><path d="M 0 1 L 1 0"></path></svg></div>];
>>

Finally, we can insert custom elements:
<<code language="reason"|
<<code language="ocaml"|
# module Page = {
let createElement = (~title, ~children, ()) => {
<html>
Expand Down

0 comments on commit 12492dc

Please sign in to comment.