feat: Render doc comments for structure fields
parent
89dd2fa46e
commit
a7c00d95e6
|
@ -10,7 +10,18 @@ open Lean
|
||||||
def fieldToHtml (f : NameInfo) : HtmlM Html := do
|
def fieldToHtml (f : NameInfo) : HtmlM Html := do
|
||||||
let shortName := f.name.components'.head!.toString
|
let shortName := f.name.components'.head!.toString
|
||||||
let name := f.name.toString
|
let name := f.name.toString
|
||||||
pure <li «class»="structure_field" id={name}>{s!"{shortName} "} : [←infoFormatToHtml f.type]</li>
|
if let some doc := f.doc then
|
||||||
|
let renderedDoc ← docStringToHtml doc
|
||||||
|
pure
|
||||||
|
<li id={name} «class»="structure_field">
|
||||||
|
<div «class»="structure_field_doc">[renderedDoc]</div>
|
||||||
|
<div «class»="structure_field_info">{s!"{shortName} "} : [←infoFormatToHtml f.type]</div>
|
||||||
|
</li>
|
||||||
|
else
|
||||||
|
pure
|
||||||
|
<li id={name} «class»="structure_field">
|
||||||
|
<div «class»="structure_field_info">{s!"{shortName} "} : [←infoFormatToHtml f.type]</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
def structureToHtml (i : StructureInfo) : HtmlM (Array Html) := do
|
def structureToHtml (i : StructureInfo) : HtmlM (Array Html) := do
|
||||||
let structureHtml :=
|
let structureHtml :=
|
||||||
|
|
|
@ -460,7 +460,7 @@ main h2, main h3, main h4, main h5, main h6 {
|
||||||
margin-left: 4ex; /* extra indentation */
|
margin-left: 4ex; /* extra indentation */
|
||||||
}
|
}
|
||||||
|
|
||||||
.imports li, code, .decl_header, .attributes, .structure_field,
|
.imports li, code, .decl_header, .attributes, .structure_field_info,
|
||||||
.constructor, .instances li, .equation, #search_results div,
|
.constructor, .instances li, .equation, #search_results div,
|
||||||
.structure_ext_ctor {
|
.structure_ext_ctor {
|
||||||
font-family: 'Source Code Pro', monospace;
|
font-family: 'Source Code Pro', monospace;
|
||||||
|
@ -491,6 +491,11 @@ pre code { padding: 0 0; }
|
||||||
margin-left: 2ex;
|
margin-left: 2ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.structure_field_doc {
|
||||||
|
text-indent: 0;
|
||||||
|
padding-top: 1ex;
|
||||||
|
}
|
||||||
|
|
||||||
.structure_ext_fields {
|
.structure_ext_fields {
|
||||||
display: block;
|
display: block;
|
||||||
padding-inline-start: 0;
|
padding-inline-start: 0;
|
||||||
|
|
Loading…
Reference in New Issue