Skip to content

Commit 105be56

Browse files
committed
feat: port an example of using signature for documenting the API
#929
1 parent 2efb355 commit 105be56

File tree

11 files changed

+1952
-20
lines changed

11 files changed

+1952
-20
lines changed

docs/_template.html

+10
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@
2525
<script type="application/javascript" src="{{root}}content/fsdocs-details-set-expanded.js"></script>
2626
<link href="{{root}}content/fsdocs-default.css" rel="stylesheet" type="text/css"/>
2727
<link href="{{root}}content/fsdocs-theme.css" rel="stylesheet" type="text/css"/>
28+
<!-- Load prism.js -->
29+
<!--
30+
TODO:
31+
We probably want to add the auto-loader plugin to make the initial prism.js as small as possible
32+
This plugin allows to load language on demand, right now I loaded the most default languages from prism.js
33+
and the ones supported by Fable.
34+
markup+css+clike+javascript+dart+fsharp+python+rust
35+
-->
36+
<link href="{{root}}content/prism/prism.css" rel="stylesheet" type="text/css"/>
37+
<script type="module" src="{{root}}content/prism/prism.js"></script>
2838
{{fsdocs-head-extra}}
2939
{{fsdocs-watch-script}}
3040
</head>

docs/content/fsdocs-default.css

+124-17
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
--code-preprocessor-color: #af75c1;
123123
--code-fsioutput-color: #808080;
124124
--code-tooltip-color: #d1d1d1;
125+
125126
}
126127

127128
/* dark theme */
@@ -671,7 +672,10 @@ a {
671672

672673
p {
673674
line-height: 1.8;
674-
margin-top: var(--spacing-300);
675+
676+
&:not(:last-child) {
677+
margin-bottom: var(--spacing-300);
678+
}
675679
}
676680

677681
ol, ul {
@@ -713,23 +717,20 @@ blockquote {
713717
/* Code snippets */
714718

715719
/* reset browser style */
716-
pre {
717-
margin: 0;
718-
padding: 0;
719-
}
720+
720721

721722
code, table.pre, pre {
722723
background-color: var(--code-background);
723724
color: var(--code-color);
724-
font-family: var(--monospace-font);
725+
font-family: var(--monospace-font);
725726
font-variant-ligatures: none;
726727
font-size: var(--font-200);
727728
-webkit-text-size-adjust: 100%;
728729
}
729730

730731
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
731732
font-size: inherit;
732-
}
733+
}
733734

734735
table.pre, #content > pre.fssnip {
735736
border: 1px solid var(--code-fence-border-color);
@@ -1062,20 +1063,11 @@ span[onmouseout] {
10621063
flex-grow: 1;
10631064
}
10641065

1065-
& pre {
1066-
margin-bottom: var(--spacing-200);
1067-
padding: var(--spacing-50);
1068-
flex-grow: 1;
1069-
overflow-x: auto;
1070-
}
10711066
}
10721067
}
10731068

10741069
.fsdocs-summary-contents {
1075-
display: flex;
1076-
flex-direction: column;
1077-
justify-content: flex-start;
1078-
align-items: flex-start;
1070+
width: 100%;
10791071
}
10801072

10811073
.fsdocs-member-xmldoc-column {
@@ -1286,3 +1278,118 @@ dialog {
12861278
opacity: 0.75;
12871279
}
12881280
}
1281+
1282+
1283+
1284+
1285+
1286+
/* Code */
1287+
1288+
.fsdocs-api-code {
1289+
font-family: var(--monospace-font);
1290+
margin-bottom: 1rem;
1291+
1292+
a.record-field-name,
1293+
a.union-case-property,
1294+
a.property {
1295+
/* color: darken($primary, 4%); */
1296+
1297+
&:hover {
1298+
text-decoration: underline;
1299+
}
1300+
}
1301+
1302+
.property[id]:target,
1303+
a[id]:target {
1304+
animation-name: blink;
1305+
animation-direction: normal;
1306+
animation-duration: 0.75s;
1307+
animation-iteration-count: 2;
1308+
animation-timing-function: ease;
1309+
}
1310+
1311+
span {
1312+
&.property {
1313+
color: var(--code-property-color);
1314+
}
1315+
1316+
&.keyword {
1317+
color: var(--code-keywords-color);
1318+
}
1319+
1320+
&.type {
1321+
color: var(--code-reference-color);
1322+
}
1323+
}
1324+
1325+
}
1326+
1327+
/*
1328+
Animations for blinking the target of a link
1329+
1330+
It makes it easier to see where the link is pointing to
1331+
*/
1332+
@keyframes blink {
1333+
0% {
1334+
background-color: var(--primary);
1335+
color: var(--background);
1336+
}
1337+
100% {
1338+
background-color: transparent;
1339+
color: var(--link-color);
1340+
}
1341+
}
1342+
1343+
.docs-example:not(:last-child) {
1344+
margin-bottom: var(--spacing-300);
1345+
}
1346+
1347+
/*
1348+
If there is parameter right after this one, add some margin.
1349+
1350+
We don't want to do it for all of them, because the last one is followed by a `hr` which already adds spacing around it.
1351+
*/
1352+
.fsdocs-doc-parameter {
1353+
margin-bottom: var(--spacing-300);
1354+
}
1355+
1356+
/*
1357+
.button {
1358+
padding: .5rem .75rem;
1359+
color: var(--text-color);
1360+
cursor: pointer;
1361+
border-radius: var(--radius);
1362+
1363+
&:has(iconify-icon) {
1364+
display: flex;
1365+
justify-content: center;
1366+
align-items: center;
1367+
}
1368+
1369+
&:hover {
1370+
background-color: var(--shadow-color);
1371+
}
1372+
} */
1373+
1374+
.fsdocs-block {
1375+
position: relative;
1376+
padding: 1rem;
1377+
1378+
&:not(:first-child) {
1379+
border-top: 1px solid var(--shadow-color);
1380+
}
1381+
1382+
.actions-buttons {
1383+
/* Buttons are in the top right of the current block */
1384+
position: absolute;
1385+
top: 1rem;
1386+
right: 1rem;
1387+
1388+
/* Should be extract as an independant .buttons class when reworking the CSS */
1389+
display: flex;
1390+
gap: .25rem;
1391+
flex-wrap: wrap;
1392+
justify-content: flex-start;
1393+
align-items: center;
1394+
}
1395+
}

0 commit comments

Comments
 (0)