feat add syntax highlighting to inline README panels

Components.inline_readme now highlights content using the server-side highlighting pipeline instead of rendering plain text. Language detection uses the optional ~filename parameter when provided; defaults to markdown highlighting (the common case for README files). All existing callers benefit without changes since markdown is the default.

Commit
5908d0b702de0c9416c63e0a4cad7c89b37b168e
Author
Marius Peter <dev@marius-peter.com>
Author date
Committer
Marius Peter <dev@marius-peter.com>
Committer date
lib/views/components.ml
index 439dd9ab..532c83f7 100644..100644
@@ -189,10 +189,21 @@
189 189 Ui.badge ~base_class:"commit-pill" ~variant:commit_type ?href commit_type
190 190
191 191 (** A README rendered below a listing. Level 3 because it sits under the page
192 Removed: heading and the listing it accompanies. *)
193 Removed: let inline_readme content =
192 Added: heading and the listing it accompanies.
193 Added:
194 Added: When [filename] is given, language detection uses it to select the
195 Added: appropriate grammar (e.g. ["README.md"] → markdown). When absent, the
196 Added: content is highlighted as markdown by default since that covers the common
197 Added: case. *)
198 Added: let inline_readme ?filename content =
199 Added: let language =
200 Added: match filename with
201 Added: | Some name -> Syntax.detect ~filename:(Some name) content
202 Added: | None -> Some "markdown"
203 Added: in
204 Added: let lines = Highlight.highlight ~lang:language content in
194 205 Ui.region ~class_:"readme-inline"
195 206 [
196 207 Ui.heading ~level:3 [ Ui.text "README" ];
197 Removed: Ui.code_listing ~class_:"blob" ~anchor_prefix:"readme-" content;
208 Added: Ui.highlighted_code_listing ~class_:"blob" ~anchor_prefix:"readme-" lines;
198 209 ]