Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More details/member docs tweaks #919

Merged
merged 3 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 44 additions & 5 deletions docs/content/fsdocs-default.css
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,8 @@ span[onmouseout] {
.fsdocs-entity-xmldoc {
> div {
display: flex;
flex-direction: row-reverse;
justify-content: flex-start;
flex-direction: row;
justify-content: space-between;
align-items: flex-start;

& p.fsdocs-summary {
Expand All @@ -1064,18 +1064,41 @@ span[onmouseout] {
}
}

.fsdocs-summary-contents {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
}

.fsdocs-member-xmldoc-column {
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
}

.icon-button-row {
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: flex-start;
height: calc(-1 * var(--spacing-200));
}

.fsdocs-member-xmldoc {
& summary {
display: list-item;
counter-increment: list-item 0;
list-style: disclosure-closed outside;
cursor: pointer;
width: calc(100% - var(--spacing-300));
margin-left: var(--spacing-300);

> .fsdocs-summary {
display: flex;
flex-direction: row-reverse;
justify-content: flex-start;
flex-direction: row;
justify-content: space-between;
align-items: flex-start;

& p.fsdocs-summary {
Expand All @@ -1098,7 +1121,7 @@ span[onmouseout] {
}

.fsdocs-returns, .fsdocs-params {
margin: var(--spacing-200);
margin: var(--spacing-200) 0 var(--spacing-200) var(--spacing-300);

&:first-child {
margin-top: 0;
Expand All @@ -1112,6 +1135,22 @@ span[onmouseout] {
.fsdocs-return-name, .fsdocs-param-name {
font-weight: 500;
}

.fsdocs-param-docs p {
margin: var(--spacing-200) 0;
}

> div.fsdocs-summary {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: flex-start;
margin: 0 0 0 var(--spacing-300);

& p {
margin: 0;
}
}
}
}

Expand Down
23 changes: 15 additions & 8 deletions src/FSharp.Formatting.ApiDocs/GenerateHtml.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let fsdocsSummary (x: ApiDocHtml) =
if x.HtmlText.StartsWith("<pre>", StringComparison.Ordinal) then
embed x
else
p [ Class "fsdocs-summary" ] [ embed x ]
div [ Class "fsdocs-summary-contents" ] [ p [ Class "fsdocs-summary" ] [ embed x ] ]

type HtmlRender(model: ApiDocModel, ?menuTemplateFolder: string) =
let root = model.Root
Expand Down Expand Up @@ -182,10 +182,12 @@ type HtmlRender(model: ApiDocModel, ?menuTemplateFolder: string) =

let smry =
div [ Class "fsdocs-summary" ] [
yield! copyXmlSigIconForSymbolMarkdown m.Symbol
yield! copyXmlSigIconForSymbol m.Symbol
yield! sourceLink m.SourceLocation
fsdocsSummary m.Comment.Summary
div [ Class "icon-button-row" ] [
yield! sourceLink m.SourceLocation
yield! copyXmlSigIconForSymbol m.Symbol
yield! copyXmlSigIconForSymbolMarkdown m.Symbol
]
]

let dtls =
Expand Down Expand Up @@ -272,7 +274,10 @@ type HtmlRender(model: ApiDocModel, ?menuTemplateFolder: string) =
if List.isEmpty dtls then
smry
elif String.IsNullOrWhiteSpace(m.Comment.Summary.HtmlText) then
yield! dtls
div [ Class "fsdocs-member-xmldoc-column" ] [
div [ Class "icon-button-row" ] (sourceLink m.SourceLocation)
yield! dtls
]
else
details [] ((summary [] [ smry ]) :: dtls)
]
Expand Down Expand Up @@ -325,10 +330,12 @@ type HtmlRender(model: ApiDocModel, ?menuTemplateFolder: string) =
]
td [ Class "fsdocs-entity-xmldoc" ] [
div [] [
yield! copyXmlSigIconForSymbolMarkdown e.Symbol
yield! copyXmlSigIconForSymbol e.Symbol
yield! sourceLink e.SourceLocation
fsdocsSummary e.Comment.Summary
div [ Class "icon-button-row" ] [
yield! sourceLink e.SourceLocation
yield! copyXmlSigIconForSymbol e.Symbol
yield! copyXmlSigIconForSymbolMarkdown e.Symbol
]
]
]
]
Expand Down
Loading