Skip to content

Commit 56b856b

Browse files
authored
Merge pull request #917 from brianrourkeboll/deets
Details improvements
2 parents 656d3c8 + f3c7326 commit 56b856b

File tree

3 files changed

+43
-48
lines changed

3 files changed

+43
-48
lines changed

RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 20.0.1 - 2024-05-31
4+
* Details improvements. [#917](https://github.com/fsprojects/FSharp.Formatting/pull/917)
5+
36
## 20.0.0 - 2024-02-14
47

58
Stable release

docs/content/fsdocs-default.css

Lines changed: 30 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
--main-grid-row: 2;
4848
--main-grid-column: 2;
4949
--dialog-width: 500px;
50+
--api-docs-first-column-min-width: 320px;
51+
--api-docs-second-column-min-width: 240px;
5052

5153
/* light theme */
5254
--primary: #1e8bc3;
@@ -1013,37 +1015,40 @@ span[onmouseout] {
10131015
padding: var(--spacing-400) 0;
10141016
}
10151017

1016-
& tbody td {
1017-
border-top: 1px solid var(--header-border);
1018-
padding: var(--spacing-300) 0;
1019-
padding-right: var(--spacing-300);
1018+
& tr {
1019+
display: flex;
1020+
flex-flow: row wrap;
1021+
column-gap: var(--spacing-300);
10201022

1021-
&:first-child a {
1023+
& td:first-of-type {
1024+
flex: 25 0 0;
1025+
min-width: var(--api-docs-first-column-min-width);
10221026
overflow-x: hidden;
10231027
text-overflow: ellipsis;
1024-
width: 100%;
1025-
display: block;
1028+
overflow-wrap: break-word;
1029+
1030+
& p {
1031+
margin: unset;
1032+
}
10261033
}
10271034

1028-
&:last-child {
1029-
padding-right: 0;
1035+
& td:nth-of-type(2) {
1036+
flex: 75 0 0;
1037+
min-width: var(--api-docs-second-column-min-width);
10301038
}
10311039
}
10321040

1033-
& thead tr td:first-child, & td.fsdocs-entity-name, & td.fsdocs-member-usage {
1034-
width: 25%;
1035-
1036-
& p {
1037-
margin: 0;
1038-
}
1041+
& tbody td {
1042+
border-top: 1px solid var(--header-border);
1043+
padding: var(--spacing-300) 0;
10391044
}
10401045

10411046
.fsdocs-entity-xmldoc {
10421047
> div {
10431048
display: flex;
10441049
flex-direction: row-reverse;
10451050
justify-content: flex-start;
1046-
align-items: center;
1051+
align-items: flex-start;
10471052

10481053
& p.fsdocs-summary {
10491054
margin: 0;
@@ -1061,12 +1066,17 @@ span[onmouseout] {
10611066

10621067
.fsdocs-member-xmldoc {
10631068
& summary {
1064-
list-style: none;
1069+
display: list-item;
1070+
counter-increment: list-item 0;
1071+
list-style: disclosure-closed outside;
1072+
cursor: pointer;
1073+
margin-left: var(--spacing-300);
10651074

10661075
> .fsdocs-summary {
10671076
display: flex;
1068-
align-items: center;
10691077
flex-direction: row-reverse;
1078+
justify-content: flex-start;
1079+
align-items: flex-start;
10701080

10711081
& p.fsdocs-summary {
10721082
margin: 0;
@@ -1080,23 +1090,15 @@ span[onmouseout] {
10801090
overflow-x: auto;
10811091
}
10821092
}
1083-
1084-
&::after {
1085-
content: '▶';
1086-
cursor: pointer;
1087-
}
10881093
}
10891094

10901095
& details[open] summary {
1096+
list-style-type: disclosure-open;
10911097
margin-bottom: var(--spacing-200);
10921098
}
10931099

1094-
& details[open] summary::after {
1095-
content: "▼";
1096-
}
1097-
10981100
.fsdocs-returns, .fsdocs-params {
1099-
margin: var(--spacing-200) 0;
1101+
margin: var(--spacing-200);
11001102

11011103
&:first-child {
11021104
margin-top: 0;
@@ -1110,23 +1112,6 @@ span[onmouseout] {
11101112
.fsdocs-return-name, .fsdocs-param-name {
11111113
font-weight: 500;
11121114
}
1113-
1114-
/* hide the browser mark and display one after the summary */
1115-
1116-
& ::marker {
1117-
display: none;
1118-
}
1119-
1120-
> div.fsdocs-summary {
1121-
display: flex;
1122-
flex-direction: row-reverse;
1123-
justify-content: space-between;
1124-
align-items: center;
1125-
1126-
> p {
1127-
margin: 0;
1128-
}
1129-
}
11301115
}
11311116
}
11321117

docs/content/fsdocs-theme.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,18 @@ if (activeItem && mainMenu) {
1212
scrollToActiveItem(activeItem);
1313
}
1414

15-
if(location.hash) {
16-
const header = document.querySelector(`a[href='${location.hash}']`);
17-
header.scrollIntoView({ behavior: 'instant'});
15+
function scrollToAndExpandSelectedMember() {
16+
if (location.hash) {
17+
const details = document.querySelector(`tr > td.fsdocs-member-usage:has(a[href='${location.hash}']) ~ td.fsdocs-member-xmldoc > details`);
18+
details?.setAttribute('open', 'true');
19+
const header = document.querySelector(`a[href='${location.hash}']`);
20+
header?.scrollIntoView({ behavior: 'instant'});
21+
}
1822
}
1923

24+
scrollToAndExpandSelectedMember();
25+
addEventListener('hashchange', scrollToAndExpandSelectedMember);
26+
2027
if(location.pathname.startsWith('/reference/')) {
2128
// Scroll to API Reference header
2229
const navHeaders = document.querySelectorAll(".nav-header");

0 commit comments

Comments
 (0)