commit f07516e53209b36f9c1c97245b5b3efa77bbdf34
parent b37f60a97ca6702ecfea0df5c6baf852f870f69a
Author: Vlad-Stefan Harbuz <vlad@vladh.net>
Date: Sun, 12 Feb 2023 15:17:24 +0000
haredoc: break long names on narrow screens
Signed-off-by: Vlad-Stefan Harbuz <vlad@vladh.net>
Diffstat:
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/cmd/haredoc/html.ha b/cmd/haredoc/html.ha
@@ -79,7 +79,7 @@ fn emit_html(ctx: *context) (void | error) = {
if (len(ident) == 0) {
fmt::fprintf(ctx.out, "<h2>The Hare standard library <span class='heading-extra'>")?;
} else {
- fmt::fprintf(ctx.out, "<h2>{} <span class='heading-extra'>", ident)?;
+ fmt::fprintf(ctx.out, "<h2><span class='heading-body'>{}</span><span class='heading-extra'>", ident)?;
};
for (let i = 0z; i < len(ctx.tags); i += 1) {
const mode = switch (ctx.tags[i].mode) {
@@ -290,7 +290,7 @@ fn details(ctx: *context, decl: ast::decl) (void | error) = {
fmt::fprintln(ctx.out, "<section class='member'>")?;
fmt::fprint(ctx.out, "<h4 id='")?;
unparse::ident(ctx.out, decl_ident(decl))?;
- fmt::fprint(ctx.out, "'>")?;
+ fmt::fprint(ctx.out, "'><span class='heading-body'>")?;
fmt::fprintf(ctx.out, "{} ", match (decl.decl) {
case ast::decl_func =>
yield "fn";
@@ -303,7 +303,7 @@ fn details(ctx: *context, decl: ast::decl) (void | error) = {
})?;
unparse::ident(ctx.out, decl_ident(decl))?;
// TODO: Add source URL
- fmt::fprint(ctx.out, "<span class='heading-extra'><a href='#")?;
+ fmt::fprint(ctx.out, "</span><span class='heading-extra'><a href='#")?;
unparse::ident(ctx.out, decl_ident(decl))?;
fmt::fprint(ctx.out, "'>[link]</a>
</span>")?;
@@ -964,9 +964,14 @@ h3 {
color: red;
}
+.heading-body {
+ word-wrap: anywhere;
+}
+
.heading-extra {
align-self: flex-end;
flex-grow: 1;
+ padding-left: 0.5rem;
text-align: right;
font-size: 0.8rem;
color: #444;