docs/qapi-domain: add CSS styling

Improve the general look and feel of generated QAPI docs.

Attempt to limit line lengths to offer a more comfortable measure on
maximized windows, and improve some margin and spacing for field lists.

Signed-off-by: Harmonie Snow <harmonie@gmail.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-ID: <20250311034303.75779-29-jsnow@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
John Snow 2025-03-10 23:42:26 -04:00 committed by Markus Armbruster
parent 03947c80ce
commit 282c8d256e

View file

@ -18,8 +18,8 @@ h1, h2, .rst-content .toctree-wrapper p.caption, h3, h4, h5, h6, legend {
.rst-content dl:not(.docutils) dt {
border-top: none;
border-left: solid 3px #ccc;
background-color: #f0f0f0;
border-left: solid 5px #bcc6d2;
background-color: #eaedf1;
color: black;
}
@ -211,6 +211,18 @@ div[class^="highlight"] pre {
/* QAPI domain theming */
/* most content in a QAPI object definition should not eclipse about
80ch, but nested field lists are explicitly exempt due to their
two-column nature */
.qapi dd *:not(dl) {
max-width: 80ch;
}
/* but the content column itself should still be less than ~80ch. */
.qapi .field-list dd {
max-width: 80ch;
}
.qapi-infopips {
margin-bottom: 1em;
}
@ -250,3 +262,43 @@ div[class^="highlight"] pre {
border-radius: 15px;
margin: 5px;
}
/* code blocks */
.qapi div[class^="highlight"] {
width: fit-content;
background-color: #fffafd;
border: 2px solid #ffe1f3;
}
/* note, warning, etc. */
.qapi .admonition {
width: fit-content;
}
/* pad the top of the field-list so the text doesn't start directly at
the top border; primarily for the field list labels, but adjust the
field bodies as well for parity. */
dl.field-list > dt:first-of-type, dl.field-list > dd:first-of-type {
padding-top: 0.3em;
}
dl.field-list > dt:last-of-type, dl.field-list > dd:last-of-type {
padding-bottom: 0.3em;
}
/* pad the field list labels so they don't crash into the border */
dl.field-list > dt {
padding-left: 0.5em;
padding-right: 0.5em;
}
/* Add a little padding between field list sections */
dl.field-list > dd:not(:last-child) {
padding-bottom: 1em;
}
/* Sphinx 3.x: unresolved xrefs */
.rst-content *:not(a) > code.xref {
font-weight: 400;
color: #333333;
}