1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-22 16:42:56 -08:00
Commit Graph

39 Commits

Author SHA1 Message Date
schwarze
00b92a3f66 While the HTML standard allows multiple <h1> elements in the same
document, <h1> is intended for top level headers, and most of the
sections in a manual page can hardly be considered top-level.
It is more usual to use <h1> only for the main title of the document
of for the site name.

Consequently, move .Sh/.SH from <h1> to <h2> and .Ss/.SS from <h2>
to <h3>, freeing <h1> for use by header.html in man.cgi(8).

Discussed with Anna Vyalkova <cyber at sysrq dot in>.
2022-07-06 14:27:54 +00:00
schwarze
8f48bc460a Finally get rid of the archaic <table> markup for header and footer lines
and use flexbox CSS instead.  Improve accessibility by adding role
and aria-label attributes to these header and footer lines.
Using ideas from both Anna Vyalkova <cyber at sysrq dot in> and myself.

As a welcome side effect, this also resolves the long-standing issue
that the rendering was always 65em wide, requiring horizontal scrolling
when the window was narrower.  Now, rendering nicely adapts to browser
windows of arbitrary narrowness.
2022-07-05 21:25:23 +00:00
schwarze
6774f271bd Instead of the custom <div class="manual-text">, use the standard
HTML <main> element.  The benefit is that it has the ARIA landmark
role "main" by default.  To ease the transition for people using
their own CSS file instead of mandoc.css, retain the custom class
for now.

I had this idea in a discussion with Anna Vyalkova <cyber at sysrq dot in>.
Patch from Anna, slightly tweaked by me.
2022-07-03 14:28:26 +00:00
schwarze
82048e2d58 Avoid legacy CSS2 syntax for the "display" property and use the CSS3
two-value syntax "display: inline flow;" instead.  In particular, there
is no need to establish a new block formatting context with "flow-root",
and in fact that's detrimental because it appears to introduce spurious
soft-wrap opportunities.

jmc@ reported a bogus line break between the opening angle bracket
generated by .Aq Mt and the following email address.
2022-03-17 18:45:43 +00:00
schwarze
4529325a8a In HTML output, correctly render .Bd -unfilled in proportionally-spaced
font, rather than with the monospace font appropriate for .Bd -literal.
This fixes a minibug reported by anton@.

Implemented by no longer relying on the typical browser default of
"pre { font-family: monospace }" but instead letting <pre> elements
inherit the font family from their parent, then adding an explicit CSS .Li
class only for those displays where the manual page author requested it
by using the -literal option on the .Bd macro.
2021-03-30 19:23:50 +00:00
schwarze
c4f9f17707 Finally get rid of the "overflow: auto" property of ".Bl-tag > dd"
which has long been know to cause ugly and pointless scroll bars.

Matthew Martin <phy1729 at gmail dot com>
helpfully explained the following two points to me:
1. What we need to do here is establish a new block formatting
context such that the first line of the <dd> content moves down
rather than to the right if the preceding <dt> is wide.
2. A comprehensive list of methods
to establish block formatting context is available in:
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context

In that list, i found that "column-count: 1" does the job.
It is part of CSS Multi-column Layout Level 1.
While that is still in Working Draft status according to
https://www.w3.org/Style/CSS/current-work ,
it is fully supported by all browsers according to
https://developer.mozilla.org/en-US/docs/Web/CSS/column-count ,
probably because it was already part of the second draft of this
standard almost 20 years ago: WD-css3-multicol-20010118.
2020-10-30 21:31:19 +00:00
schwarze
9daec1c560 Support prefers-color-scheme: dark.
The :visited rule was contributed by <Armin at Besirovic dot com>.
Guidance and OK tj@.
2019-06-02 16:50:46 +00:00
schwarze
1a2b7b3c4d Wrap .Sh/.SH sections and .Ss/.SS subsections in HTML <section> elements
as recommended for accessibility by the HTML 5 standard.
Triggered by a similar, but slightly different suggestion
from Laura Morales <lauretas at mail dot com>.
2019-03-01 10:48:58 +00:00
schwarze
0ce603aba0 Remove the HTML title= attributes which harmed accessibility and
violated the principle of separation of content and presentation.
Instead, implement the tooltips purely in CSS.
Thanks to John Gardner <gardnerjohng at gmail dot com> for
suggesting most of the styling in the new ::before rules.
2019-01-11 12:44:10 +00:00
schwarze
39757f2be6 After years of gnashing of teeth, i finally found a way to avoid
having to write empty list elements for non-compact .Bl -tag lists:

1. Add margin-bottom to the <dd>.
Note that margin-top on the <dt> doesn't work because it would put
a short <dt> lower than the <dd>; margin-bottom on the <dt> doesn't
work because it would put vertical space before the <dd> for a long
<dt>; and margin-top on the <dd> doesn't work because it would put
a short <dt> higher than the <dd>.  Only margin-bottom on the <dd>
has none of these adverse effects.

2. Of course, margin-bottom on the <dd> fails to take care of the
vertical spacing before the first list element, so implement that
separately by margin-top on the <dl>.

3. For .Bl -tag -compact, reset both to zero.
2019-01-10 07:39:39 +00:00
schwarze
1db9d35d36 Restrict "vertical-align: middle;" to <td> descendants of class="tbl"
elements, we don't want that for other tables.
2018-12-04 06:11:44 +00:00
schwarze
d40116fe07 Make sure all borders in a table are drawn in the same color.
Required because browsers tend to have inconsistent defaults:
For example, Firefox 62.0.2 sets border-color for tbody, but not for table,
and Pali Rohar reports that Chrome set it for td, but not for tr or tbody.
The td part is from Pali Rohar, the tbody and tr parts from me.
2018-12-04 05:20:14 +00:00
schwarze
5e80c341c1 Implement tbl(7) lines in -T html output,
as far as they are on the edges of table cells
rather than going through the middle of cells:

* the box, doublebox, and allbox options;
* the | and || layout modifiers;
* and the _ and = data lines;
- but not yet _ and = in individual layout and data cells.

Missing feature reported by Pali dot Rohar at gmail dot com.
2018-11-26 21:05:54 +00:00
schwarze
ce83d2c0a1 Place mandoc.css into the public domain.
The reason for doing this rather than using the ISC license
is that i guess that in some contexts, a requirement to preserve
a Copyright and license header might be inconvenient, and i really
don't care at all how people use it.

What matters is that they do use it, or something similar - attempts
to use mandoc without any CSS are a constant source of grief and
bogus bug reports because HTML without CSS doesn't look very good:
the more structural and semantic and the less presentational and
old-fashioned the HTML, the more so.

Thanks to Mark Harris <mark dot hsj at gmail dot com> for pointing out
that the permissions on this particular file were unclear.
2018-11-26 15:01:38 +00:00
schwarze
6bcc7ca88f Implement horizontal and vertical alignment of tbl(7) cell content
in -T html output.  This does not handle spanned cells yet.
Missing feature reported by Pali dot Rohar at gmail dot com.
2018-11-24 23:03:13 +00:00
schwarze
dd2c5c742a Reduce excessive right padding in tagged list heads.
The 1.2em was an approximate equivalent of the 2n traditionally used
for terminal display, but it is much too wide for HTML rendering.
Issue reported by mikeb@.
2018-08-27 23:12:57 +00:00
schwarze
271fbe1fb3 Remove more redundant element selectors where the class selector
is already sufficient.  John Gardner tells me that "CSS selectors
should only contain what's necessary to target their subjects".
2018-07-23 22:51:24 +00:00
schwarze
849c58d769 replace the last instances of ex units by em;
recommended by John Gardner <gardnerjohng at gmail dot com>
2018-07-23 22:33:54 +00:00
schwarze
dd2b196545 For -man -Thtml, ignore author-specified .HP widths because they
harm responsive design; use @media-dependent defaults instead.
2018-06-25 13:01:14 +00:00
schwarze
7bdf9c462e In HTML output, for lists that have an -indent argument, just use
a uniform indentation in CSS adapted to the viewport width and
ignore the value of the argument taken from mdoc(7).  While
author-specified widths somewhat work as a micro-optimization in
terminal and typeset output, they are nothing but harmful in HTML
style= attributes because they break responsive design, whereas
using a reasonable default indent almost never results in ugly
output.  Admittedly, the author-specified width might occasionally
look even better, but only slightly so, and only for some viewport
sizes.
Based on guidance provided by John Gardner.
2018-06-10 16:15:40 +00:00
schwarze
4338e60e47 John Gardner tells me that among frontend developers, gratuitous use
of double selectors like "element.class" is considered poor style.
When doing selection mainly by elements is not appropriate because
most elements require several different styles, exclusively selecting
by class is less cumbersome, more concise, and more flexible.
So drop the elements from the selectors, except where they are
required for disambiguation and except where they add clarity due
to the presence of child selectors.
2018-05-28 15:39:20 +00:00
schwarze
89474aeb6e Start with baby steps towards responsive design:
Use a @media width query to select a set of default indentations.
Suggested by John Gardner <gardnerjohng at gmail dot com>.
2018-05-26 20:04:38 +00:00
schwarze
116e5c8da0 Use em units rather than ex units for horizontal lengths.
John Gardner and others tell me it produces more predictable results
and is generally considered better style.
Also use 0em instead of 0ex, in general.
2018-05-26 17:37:47 +00:00
schwarze
dd6ffdfc34 Use <span> for .Ms rather than <b>; discussed with John Gardner. 2018-05-21 01:10:06 +00:00
schwarze
e34b78c5cc Use <span> for .Ad rather than <i>; also suggested by John Gardner. 2018-05-21 00:29:41 +00:00
schwarze
d4430aa566 Use <span> rather than abusing <i> for .Pa;
suggested by John Gardner <gardnerjohng at gmail dot com>.
2018-05-20 23:54:15 +00:00
schwarze
2e36b50795 Fix a long-standing issue:
Some macros (Nd, Oo) can contain blocks but rendered as elements that
can only contain phrasing content, resulting in invalid HTML nesting.
Switch them to <div>.
Also move the related "display: inline" style from the HTML to the CSS.

Reminded during a conversation with John Gardner.
2018-05-09 00:45:33 +00:00
schwarze
492a74ca7d Eliminate the class=It-* attributes.
Cleaner HTML, more idiomatic CSS, and minus 30 lines of C code.
Suggested by John Gardner <gardnerjohng at gmail dot com>.
2018-05-08 21:42:11 +00:00
schwarze
2f6b432e1e Switch the emitted HTML element from <b> to <code> for the fixed
syntax element macros .Nm, .Fl, .Cm, .Ic, .In, .Fd, .Fn, and .Cd.
Adjust both the internal and external style sheets such that
rendering remains unchanged in typical browsers.

Based on feedback from John Gardner <gardnerjohng at gmail dot com>.
2018-05-08 17:52:24 +00:00
schwarze
687b5bcb0d replace my vague and idiosyncratic term "selflink"
with the clearer and more usual "permalink";
suggested by John Gardner <gardnerjohng at gmail dot com>
2018-04-24 00:36:04 +00:00
schwarze
051753d580 The only elements using floats are dt.It-tag, so the only elements
allowed to the right of them are dd.It-tag.
Fixes overlapping rendering after long tag lists without bodies,
for example in the Xenocara apm(4) manual.  Issue reported by tj@.
2017-07-16 18:44:15 +00:00
schwarze
4a07f2db85 use the same width increase logic for .Bl -hang as for .Bl -tag 2017-07-15 17:29:26 +00:00
schwarze
7dd771a32d correct left margins for different classes of definition lists 2017-07-15 16:35:48 +00:00
schwarze
c67bdbbda5 Handle .Bl -compact via CSS rather than writing individual style
attributes into .It blocks; suggested by Steffen Nurpmeso <steffen
at sdaoden dot eu> on <groff at GNU dot org> in April 2017.

Delete margin-bottom and margin-top style names and the 'v' argument
letter from print_otag() because they are no longer used.
2017-07-14 16:05:52 +00:00
schwarze
6306e64da6 Port ctags-style, less(1) :t internal searching from terminal output
to HTML output.  For certain macros appearing at the beginning of .It
heads, write HTML id="..." attributes such that deep linking works.
Write HTML <a> attributes such that you can easily copy out link
targets with the mouse.  Try: http://man.openbsd.org/vmctl.8#create

Feature suggested by <guettliml at Thomas dash Guettler dot de>,
some details of the design and implementation by me.
2017-03-13 20:22:11 +00:00
schwarze
dd15d0f1a6 Wrap .St content in a <span class="St">.
Also add forgotten <span class="Ux"> to .At rendering.
2017-02-05 21:00:18 +00:00
schwarze
6bddd96e86 mark up .Ar, .Fa, .Va, .Ft, and .Vt with <var> rather than <i>;
suggested by bentley@ long ago, but needed lots of cleanup first
2017-02-05 20:21:17 +00:00
schwarze
d08309340c for .Rs, use <cite> 2017-02-05 19:29:03 +00:00
schwarze
fa5f2fce61 Add the style sheet used on man.openbsd.org to the source tree.
It is NOT used during "make build" and NOT installed, but it is
helpful for people trying to read and understand html.c and mdoc_html.c,
and maybe even for users of mandoc -Thtml.

OK deraadt@
2017-01-25 02:54:53 +00:00