package tm-grammars
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
TextMate grammars as OCaml strings
Install
dune-project
Dependency
Authors
Maintainers
Sources
tm-grammars-1.0.0.tbz
sha256=a44a4f0d07ee70c464a13960e8250c4913d70737161eb89a2b9fbc4c1e166916
sha512=184a5cb893392366c22438a87f6bf5d414cb2de129ccf0bd5c4748971f5c8e07da2d71795de5d23290b23b0a49753bcfff6e83a45d13c5295029f0eed5aa12fb
Description
OCaml package that exposes TextMate grammars as JSON strings.
Published: 03 Mar 2026
README
tm-grammars
OCaml package that exposes TextMate grammars as JSON strings. Each language is available as a library ([tm-grammars.ocaml], [tm-grammars.tsx], etc.) so downstream users only link what they need.
Install
opam install tm-grammars -yUsage
(libraries tm-grammars)let grammar_ocaml = Tm_grammars.ocaml
let grammar_tsx = Tm_grammars.tsxYou can also list grammars dynamically:
let all = Tm_grammars.all (* (string * string) list *)
let ids = Tm_grammars.available (* string list *)Use a single grammar
Depend on a sublibrary to pull in only the grammar you need.
(libraries tm-grammars.ocaml tm-grammars.tsx)let grammar_ocaml = Tm_grammar_ocaml.json
let grammar_tsx = Tm_grammar_tsx.jsonSupported language ids
c, cpp, cram, css, diff, dockerfile, dune, go, graphql, html, java, javascript, json, jsonc, makefile, markdown, menhir, mlx, ocaml, ocamllex, opam, python, reason, ruby, rust, shellscript, sql, toml, tsx, typescript, yaml.
How to add a new grammar
- Add a new entry in sources.json with the language id and upstream source (
repo,path,commit). - Run
make syncto download the grammar intovendor/<language-id>.json. - Run
make generateto regenerate packages and metadata. - Run
make build(and optionallymake test) to verify everything still builds.
License
MIT. See LICENSE.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page