Skip to content

Commit 15980a1

Browse files
committed
feat: use output from new doc-ci with odoc 3 features in the package documentation area #3124 (
b30d4c1 )
1 parent 81bb38f commit 15980a1

File tree

15 files changed

+647
-263
lines changed

15 files changed

+647
-263
lines changed

asset/css/doc.css

Lines changed: 285 additions & 3 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,12 +188,12 @@ 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
}
193195

194-
.dark div.odoc a {
196+
.dark div.odoc a:not(.source_code a) {
195197
text-decoration: underline;
196198
color:white;
197199
}
@@ -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,263 @@ span.sign-expand.open::before {
359381
/* Lists of modules */
360382

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

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)