[OCaml] Mobile-friendly clone of cgit.
feat wire server-side highlighting into blob file view
Replace the client-side highlight.js approach with server-rendered syntax highlighting in the /file/<blob> view: - Syntax.detect identifies the language from filename/shebang/modeline - Highlight.highlight tokenizes the source with TextMate grammars - Ui.highlighted_code_listing renders the pre-highlighted spans The blob view no longer requires JavaScript for syntax colouring.
lib/views/repo.ml
@@ -333,9 +333,8 @@
333
333
render_page context ~active ~toolbar
334
334
[
335
335
raw_link;
336
Removed:
Ui.code_listing ~id:"blob"
337
Removed:
?class_:(Option.map (Printf.sprintf "language-%s") language)
338
Removed:
blob.content;
336
Added:
(let lines = Highlight.highlight ~lang:language blob.content in
337
Added:
Ui.highlighted_code_listing ~id:"blob" lines);
339
338
]
340
339
341
340
let commit context (commit : Resolvers.Commit.t) diff =