OCaml HTML5 parser/serialiser based on Python's JustHTML
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 61 lines 1.9 kB view raw
1(** Message output formatters. 2 3 This module provides various output formats for validation messages, 4 including text, JSON, and GNU-style formats for IDE integration. *) 5 6(** {1 Formatters} *) 7 8(** Format messages as human-readable text. 9 10 Output format: [file:line:col: severity: message] 11 12 @param system_id Optional default system identifier for messages without location. *) 13val format_text : ?system_id:string -> Message.t list -> string 14 15(** Format messages as JSON. 16 17 Produces output compatible with the Nu HTML Validator JSON format. 18 19 @param system_id Optional default system identifier for messages without location. *) 20val format_json : ?system_id:string -> Message.t list -> string 21 22(** Format messages in GNU style for IDE integration. 23 24 Output format follows GNU conventions for error messages, compatible 25 with most IDEs and editors. 26 27 @param system_id Optional default system identifier for messages without location. *) 28val format_gnu : ?system_id:string -> Message.t list -> string 29 30(** {1 JSON Value Builders} 31 32 These functions return [Jsont.json] values that can be reused 33 for custom JSON encoding scenarios. *) 34 35(** Convert a single message to JSON AST. 36 37 Produces JSON compatible with the Nu HTML Validator format: 38 {[ 39 { 40 "type": "error", 41 "message": "...", 42 "subType": "error-code", 43 "url": "...", 44 "firstLine": 1, 45 "firstColumn": 1, 46 ... 47 } 48 ]} 49 50 @param system_id Default system identifier for messages without location.system_id. *) 51val message_to_json : ?system_id:string -> Message.t -> Jsont.json 52 53(** Convert a message list to JSON AST with wrapper object. 54 55 Produces JSON with a "messages" array: 56 {[ 57 { "messages": [...] } 58 ]} 59 60 @param system_id Default system identifier for messages without location.system_id. *) 61val messages_to_json : ?system_id:string -> Message.t list -> Jsont.json