Skip to content

Commit d2674ce

Browse files
committed
feat: use output from new doc-ci with odoc 3 features in the package documentation area #3124 (e9d2ab9)
1 parent 85c81ae commit d2674ce

File tree

15 files changed

+584
-262
lines changed

15 files changed

+584
-262
lines changed

asset/css/doc.css

Lines changed: 278 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[x-cloak] { display: none !important; }
2+
13
div.odoc {
24
max-width: 56rem /* 896px */;
35
position: relative;
@@ -186,7 +188,7 @@ div.odoc span.at-tag {
186188
font-weight: bold;
187189
}
188190

189-
div.odoc a {
191+
div.odoc a:not(.source_code a) {
190192
font-weight: bold;
191193
color: #cc4e0c;
192194
}
@@ -314,6 +316,24 @@ div.odoc .comment-delim {
314316
border-color: rgb(32, 68, 165);
315317
}
316318

319+
.navmap-tag.page-tag::after {
320+
content: "P";
321+
}
322+
.page-tag{
323+
color: rgb(32, 68, 165);
324+
background-color: rgb(32, 68, 165);
325+
border-color: rgb(32, 68, 165);
326+
}
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+
317337
span.icon-expand > .navmap-tag,
318338
span.no-expand > .navmap-tag {
319339
color: white;
@@ -344,10 +364,12 @@ span.arrow-expand.open {
344364
}
345365

346366
span.sign-expand::before {
347-
content: " \002B";
367+
content: "\002B";
348368
display: flex;
369+
justify-content: center;
349370
align-items: center;
350371
font-size: 1.25rem;
372+
width: 1.25rem;
351373
margin-top: -0.25rem;
352374
}
353375

@@ -359,3 +381,257 @@ span.sign-expand.open::before {
359381
/* Lists of modules */
360382

361383
.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+
}
415+
416+
/* Taken from odoc's css sheet */
417+
418+
:root,
419+
.light:root {
420+
421+
/* light gruvbox theme colors */
422+
--bg_h: #f9f5d7;
423+
--bg: #f6f8fa; /*#fbf1c7;*/
424+
--bg_s: #f2e5bc;
425+
--bg1: #ebdbb2;
426+
--bg2: #d5c4a1;
427+
--bg3: #bdae93;
428+
--bg4: #a89984;
429+
430+
--fg: #282828;
431+
--fg1: #3c3836;
432+
--fg2: #504945;
433+
--fg3: #665c54;
434+
--fg4: #7c6f64;
435+
436+
--red: #9d0006;
437+
--green: #79740e;
438+
--yellow: #b57614;
439+
--blue: #076678;
440+
--purple: #8f3f71;
441+
--aqua: #427b58;
442+
--orange: #af3a03;
443+
--gray: #928374;
444+
445+
--red-dim: #cc2412;
446+
--green-dim: #98971a;
447+
--yellow-dim: #d79921;
448+
--blue-dim: #458598;
449+
--purple-dim: #b16286;
450+
--aqua-dim: #689d6a;
451+
--orange-dim: #d65d0e;
452+
--gray-dim: #7c6f64;
453+
454+
/* odoc colors */
455+
--odoc-blue: #5c9cf5;
456+
--odoc-bg: #FFFFFF;
457+
--odoc-bg1: #f6f8fa;
458+
--odoc-fg: #333333;
459+
--odoc-fg1: #1F2D3D;
460+
461+
}
462+
463+
@media (prefers-color-scheme: dark) {
464+
:root {
465+
/* dark gruvbox theme colors */
466+
--bg_h: #1d2021;
467+
--bg: #282828;
468+
--bg_s: #32302f;
469+
--bg1: #3c3836;
470+
--bg2: #504945;
471+
--bg3: #665c54;
472+
--bg4: #7c6f64;
473+
474+
--fg: #fbf1c7;
475+
--fg1: #ebdbb2;
476+
--fg2: #d5c4a1;
477+
--fg3: #bdae93;
478+
--fg4: #a89984;
479+
480+
--red: #fb4934;
481+
--green: #b8bb26;
482+
--yellow: #fabd2f;
483+
--blue: #83a598;
484+
--purple: #d3869b;
485+
--aqua: #8ec07c;
486+
--gray: #928374;
487+
--orange: #fe8019;
488+
489+
--red-dim: #cc2412;
490+
--green-dim: #98971a;
491+
--yellow-dim: #d79921;
492+
--blue-dim: #458588;
493+
--purple-dim: #b16286;
494+
--aqua-dim: #689d6a;
495+
--gray-dim: #a89984;
496+
--orange-dim: #d65d0e;
497+
498+
/* odoc colors */
499+
--odoc-blue: #5c9cf5;
500+
--odoc-bg: #202020;
501+
--odoc-bg1: #252525;
502+
--odoc-fg: #bebebe;
503+
--odoc-fg1: #777;
504+
}
505+
}
506+
507+
:root {
508+
--source-link-color: var(--fg4);
509+
--source-line-column: var(--fg3);
510+
--source-line-column-bg: var(--bg_h);
511+
512+
--source-code-comment: var(--gray);
513+
--source-code-docstring: var(--green-dim);
514+
--source-code-lident: var(--fg1);
515+
--source-code-uident: var(--blue);
516+
--source-code-literal: var(--yellow);
517+
--source-code-keyword: var(--red);
518+
--source-code-underscore: var(--fg3);
519+
--source-code-operator: var(--purple);
520+
--source-code-parens: var(--orange-dim);
521+
--source-code-separator: var(--orange-dim);
522+
}
523+
524+
525+
/* Linked highlight */
526+
.source_code *:target {
527+
border-radius: 1px;
528+
border: var(--orange-dim) 2px solid !important;
529+
}
530+
531+
/* Keywords */
532+
.AND, .ANDOP, .AS, .ASSERT,
533+
.BAR, .BEGIN,
534+
.CLASS, .CONSTRAINT,
535+
.DO, .DONE, .DOWNTO,
536+
.ELSE, .END, .EXCEPTION, .EXTERNAL,
537+
.FOR, .FUN, .FUNCTION, .FUNCTOR,
538+
.IF, .IN, .INCLUDE, .INHERIT, .INITIALIZER,
539+
.LAZY, .LESSMINUS, .LET, .LETOP,
540+
.MATCH, .METHOD, .MINUSGREATER, .MODULE, .MUTABLE,
541+
.NEW, .NONREC,
542+
.OBJECT, .OF, .OPEN,
543+
.PERCENT, .PRIVATE,
544+
.REC,
545+
.SEMISEMI, .SIG, .STRUCT,
546+
.THEN, .TO, .TRY, .TYPE,
547+
.VAL, .VIRTUAL,
548+
.WHEN, .WITH, .WHILE
549+
{
550+
color: var(--source-code-keyword);;
551+
}
552+
553+
/* Separators */
554+
.COMMA, .COLON, .COLONGREATER, .SEMI {
555+
color: var(--source-code-separator);
556+
}
557+
558+
/* Parens
559+
`begin` and `end ` are excluded because `end` is used in other, more
560+
keyword-y contexts*/
561+
.BARRBRACKET,
562+
.LBRACE,
563+
.LBRACELESS,
564+
.LBRACKET,
565+
.LBRACKETAT,
566+
.LBRACKETATAT,
567+
.LBRACKETATATAT,
568+
.LBRACKETBAR,
569+
.LBRACKETGREATER,
570+
.LBRACKETLESS,
571+
.LBRACKETPERCENT,
572+
.LBRACKETPERCENTPERCENT,
573+
.LPAREN,
574+
.RBRACE,
575+
.RBRACKET,
576+
.RPAREN
577+
{
578+
color: var(--source-code-parens);
579+
}
580+
581+
/* Prefix operators */
582+
.ASSERT, .BANG, .PREFIXOP,
583+
/* Infix operators.
584+
A choice had to be made for equal `=` which is both a keyword and an operator.
585+
It looked better having it as an operator, because when it is a keyword,
586+
there are already loads of keyword around.
587+
It would look even nicer if there was a way to distinguish between these
588+
two cases.*/
589+
.INFIXOP0, .INFIXOP1, .INFIXOP2, .INFIXOP3, .INFIXOP4,
590+
.BARBAR, .PLUS, .STAR, .AMPERAMPER, .AMPERAND, .COLONEQUAL, .GREATER, .LESS,
591+
.MINUS, .MINUSDOT, .MINUSGREATER, .OR, .PLUSDOT, .PLUSEQ, .EQUAL
592+
{
593+
color: var(--source-code-operator);
594+
}
595+
596+
/* Upper case ident
597+
`true` and `false` are considered uident here, because you can bind them in a
598+
constructor defintion :
599+
```ocaml
600+
type my_bool =
601+
| true of string
602+
| false
603+
| Other of int
604+
```
605+
*/
606+
.UIDENT, .COLONCOLON, .TRUE, .FALSE {
607+
color: var(--source-code-uident);
608+
609+
}
610+
611+
/* Lower case idents.
612+
Quotes are here because of `type 'a t = 'a list`,
613+
and question mark and tildes because of
614+
```ocaml
615+
let f ~a ?b () = Option.map a b
616+
```
617+
*/
618+
.LIDENT, .QUESTION, .QUOTE, .TILDE {
619+
color: var(--source-code-lident);
620+
}
621+
622+
/* Litterals */
623+
.STRING, .CHAR, .INT, .FLOAT, .QUOTED_STRING_EXPR, .QUOTED_STRING_ITEM {
624+
color: var(--source-code-literal);
625+
}
626+
627+
.UNDERSCORE {
628+
color: var(--source-code-underscore);
629+
}
630+
631+
.DOCSTRING {
632+
color: var(--source-code-docstring);
633+
}
634+
635+
.COMMENT {
636+
color: var(--source-code-comment);
637+
}

dune-project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
ezjsonm
7474
lambdasoup
7575
ptime
76+
ppx_deriving_yojson
7677
(cmdliner
7778
(>= 1.1.0))
7879
xmlm

ocamlorg.opam

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ depends: [
4949
"ezjsonm"
5050
"lambdasoup"
5151
"ptime"
52+
"ppx_deriving_yojson"
5253
"cmdliner" {>= "1.1.0"}
5354
"xmlm"
5455
"uri"

0 commit comments

Comments
 (0)