in src/PageSections/ShapeFields.hack [19:53]
public function getMarkdown(): ?string {
$t = $this->definition;
// Intentionally not documenting opaque type aliases
if (!$t is ScannedType) {
return null;
}
$t = $t->getAliasedType();
if (!$t->isShape()) {
return null;
}
return Vec\map(
$t->getShapeFields(),
$field ==> {
$docs = $field->getDocComment();
if ($docs === null) {
$docs = '';
} else {
$docs = ' - '.(new DocBlock($docs))->getSummary() ?? '';
}
return Str\format(
'- `%s%s: %s`%s',
$field->isOptional() ? '?' : '',
_Private\stringify_expression($field->getName()),
_Private\stringify_typehint(
$this->definition->getNamespaceName(),
$field->getValueType(),
),
$docs,
);
},
)
|> Str\join($$, "\n")
|> "## Fields\n\n".$$;
}