package hilite
Build time syntax highlighting
Install
Dune Dependency
Authors
Maintainers
Sources
hilite-0.4.0.tbz
sha256=1bc335d3f1fb32ecd7888e98ec5b01c94ad4393ad96e80d5e4040931db8858e8
sha512=17cc6db24895b946d98e28db2698bdac41feac63fd97ea7ec8c88b67b38bb10a8b5ca9accb54e6f15caa8ab49234b075301a5888913fe0d493a931114fb02d44
Description
A library for adding syntax highlighting to OCaml-related code and outputing to HTML
README
Hilite 🎨
A small library that generates HTML ready for syntax-highlighting with CSS by parsing markdown documents.
Currently only some OCaml-related syntaxes are supported.
let md = {|
"Hello World!" in OCaml looks like:
~~~ocaml
let () = print_endline "Hello World!"
~~~
|}
And converting is as simple as...
# Cmarkit.Doc.of_string md |> Hilite.Md.transform |> Cmarkit_html.of_doc ~safe:false;;
- : string =
"<p>"Hello World!" in OCaml looks like:</p>\n<pre><code><span class='ocaml-keyword-other'>let</span><span class='ocaml-source'> </span><span class='ocaml-constant-language-unit'>()</span><span class='ocaml-source'> </span><span class='ocaml-keyword-operator'>=</span><span class='ocaml-sourc"... (* string length 609; truncated *)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page