File tree Expand file tree Collapse file tree 5 files changed +61
-2
lines changed
ocamlorg_frontend/components Expand file tree Collapse file tree 5 files changed +61
-2
lines changed Original file line number Diff line number Diff line change @@ -325,6 +325,15 @@ div.odoc .comment-delim {
325
325
border-color : rgb (32 , 68 , 165 );
326
326
}
327
327
328
+ .navmap-tag .source-tag ::after {
329
+ content : "S" ;
330
+ }
331
+ .source-tag {
332
+ color : rgb (97 , 8 , 138 );
333
+ background-color : rgb (97 , 8 , 138 );
334
+ border-color : rgb (97 , 8 , 138 );
335
+ }
336
+
328
337
span .icon-expand > .navmap-tag ,
329
338
span .no-expand > .navmap-tag {
330
339
color : white;
@@ -372,3 +381,34 @@ span.sign-expand.open::before {
372
381
/* Lists of modules */
373
382
374
383
.modules { list-style-type : none; padding-left : 0 ; }
384
+
385
+ /* Source links float inside preformated text or headings. */
386
+ a .source_link {
387
+ float : right;
388
+ color : var (--source-link-color );
389
+ font-family : "Fira Sans" , sans-serif;
390
+ font-size : initial;
391
+ }
392
+
393
+
394
+ .source_container {
395
+ display : flex;
396
+ }
397
+
398
+ .source_line_column {
399
+ padding-right : 0.5em ;
400
+ text-align : right;
401
+ color : var (--source-line-column );
402
+ background : var (--source-line-column-bg );
403
+ }
404
+
405
+ .source_line {
406
+ padding : 0 1em ;
407
+ }
408
+
409
+ .source_code {
410
+ flex-grow : 1 ;
411
+ background : var (--code-background );
412
+ padding : 0 0.3em ;
413
+ color : var (--code-color );
414
+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ type kind =
8
8
| Class
9
9
| Class_type
10
10
| File
11
+ | Source
11
12
12
13
type toc = {
13
14
title : string;
@@ -26,6 +27,7 @@ let kind_title = function
26
27
| Parameter -> "Parameter"
27
28
| Class -> "Class"
28
29
| Class_type -> "Class type"
30
+ | Source -> "Source"
29
31
| _ -> "?"
30
32
31
33
let title_style = "flex-1 flex-nowrap py-1 md:py-0.5 pr-1 text-title dark:text-dark-title truncate"
@@ -40,6 +42,7 @@ let icon_style = function
40
42
| Parameter -> "navmap-tag parameter-tag"
41
43
| Class -> "navmap-tag class-tag"
42
44
| Class_type -> "navmap-tag class-type-tag"
45
+ | Source -> "navmap-tag source-tag"
43
46
| _ -> "navmap-tag"
44
47
45
48
let rec nested_render ~path (item : toc) =
@@ -135,6 +138,7 @@ let render
135
138
<span class="<%s icon_style Module_type %>" style="display:inline-block;color:white"></span>Module type<br>
136
139
<span class="<%s icon_style Parameter %>" style="display:inline-block;color:white"></span>Parameter<br>
137
140
<span class="<%s icon_style Class %>" style="display:inline-block;color:white"></span>Class<br>
138
- <span class="<%s icon_style Class_type %>" style="display:inline-block;color:white"></span>Class type
141
+ <span class="<%s icon_style Class_type %>" style="display:inline-block;color:white"></span>Class type<br>
142
+ <span class="<%s icon_style Source %>" style="display:inline-block;color:white"></span>Source
139
143
</div>
140
144
<% ); %>
Original file line number Diff line number Diff line change @@ -241,6 +241,7 @@ module Documentation = struct
241
241
| Class
242
242
| ClassType
243
243
| File
244
+ | Source
244
245
245
246
let breadcrumb_kind_from_string s =
246
247
match s with
@@ -251,6 +252,7 @@ module Documentation = struct
251
252
| "class" -> Class
252
253
| "class-type" -> ClassType
253
254
| "file" -> File
255
+ | "source" -> Source
254
256
| _ ->
255
257
if String. starts_with ~prefix: " argument-" s then
256
258
let i = List. hd (List. tl (String. split_on_char '-' s)) in
@@ -311,6 +313,17 @@ module Documentation = struct
311
313
toc = List. map toc_of_json json_toc;
312
314
content = header ^ preamble ^ content;
313
315
}
316
+ | `Assoc
317
+ [
318
+ (" type" , `String " source" );
319
+ (" breadcrumbs" , `List json_breadcrumbs);
320
+ (" global_toc" , _);
321
+ (" header" , `String header);
322
+ (" content" , `String content);
323
+ ] ->
324
+ let breadcrumbs = List. map breadcrumb_from_json json_breadcrumbs in
325
+ let content = header ^ content in
326
+ { uses_katex = false ; breadcrumbs; toc = [] ; content }
314
327
| _ -> raise (Invalid_argument " malformed .html.json file" )
315
328
end
316
329
Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ module Documentation : sig
80
80
| Class
81
81
| ClassType
82
82
| File
83
+ | Source
83
84
84
85
type breadcrumb = {
85
86
name : string ;
Original file line number Diff line number Diff line change @@ -1271,6 +1271,7 @@ let package_documentation t kind req =
1271
1271
| Some "class" -> Class
1272
1272
| Some "class-type" -> Class_type
1273
1273
| Some "file" -> File
1274
+ | Some "source" -> Source
1274
1275
| None -> Page
1275
1276
| _ -> File );
1276
1277
href = map_url sidebar.node.url;
@@ -1301,7 +1302,7 @@ let package_documentation t kind req =
1301
1302
| Parameter i -> Parameter (b, i)
1302
1303
| Class -> Class b
1303
1304
| ClassType -> ClassType b
1304
- | Page | LeafPage | File -> Page b
1305
+ | Page | LeafPage | File | Source -> Page b
1305
1306
in
1306
1307
1307
1308
Ocamlorg_frontend.Package_breadcrumbs. Documentation
You can’t perform that action at this time.
0 commit comments