Print this page
9718 update mandoc to 1.14.4

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man1/mandoc.1
          +++ new/usr/src/man/man1/mandoc.1
   1      -.\"     $Id: mandoc.1,v 1.217 2017/07/20 15:26:41 schwarze Exp $
        1 +.\"     $Id: mandoc.1,v 1.226 2018/07/28 18:34:15 schwarze Exp $
   2    2  .\"
   3    3  .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
   4      -.\" Copyright (c) 2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org>
        4 +.\" Copyright (c) 2012, 2014-2018 Ingo Schwarze <schwarze@openbsd.org>
   5    5  .\"
   6    6  .\" Permission to use, copy, modify, and distribute this software for any
   7    7  .\" purpose with or without fee is hereby granted, provided that the above
   8    8  .\" copyright notice and this permission notice appear in all copies.
   9    9  .\"
  10   10  .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  11   11  .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12   12  .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  13   13  .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14   14  .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15   15  .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16   16  .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17   17  .\"
  18      -.Dd $Mdocdate: July 20 2017 $
       18 +.Dd $Mdocdate: July 28 2018 $
  19   19  .Dt MANDOC 1
  20   20  .Os
  21   21  .Sh NAME
  22   22  .Nm mandoc
  23   23  .Nd format manual pages
  24   24  .Sh SYNOPSIS
  25   25  .Nm mandoc
  26   26  .Op Fl ac
  27   27  .Op Fl I Cm os Ns = Ns Ar name
  28   28  .Op Fl K Ar encoding
  29   29  .Op Fl mdoc | man
  30   30  .Op Fl O Ar options
  31   31  .Op Fl T Ar output
  32   32  .Op Fl W Ar level
  33   33  .Op Ar
  34   34  .Sh DESCRIPTION
  35   35  The
  36   36  .Nm
  37      -utility formats
  38      -.Ux
  39      -manual pages for display.
       37 +utility formats manual pages for display.
  40   38  .Pp
  41   39  By default,
  42   40  .Nm
  43   41  reads
  44   42  .Xr mdoc 5
  45   43  or
  46   44  .Xr man 5
  47   45  text from stdin and produces
  48   46  .Fl T Cm locale
  49   47  output.
↓ open down ↓ 61 lines elided ↑ open up ↑
 111  109  .It Fl mdoc | man
 112  110  With
 113  111  .Fl mdoc ,
 114  112  all input files are interpreted as
 115  113  .Xr mdoc 5 .
 116  114  With
 117  115  .Fl man ,
 118  116  all input files are interpreted as
 119  117  .Xr man 5 .
 120  118  By default, the input language is automatically detected for each file:
 121      -if the the first macro is
      119 +if the first macro is
 122  120  .Ic \&Dd
 123  121  or
 124  122  .Ic \&Dt ,
 125  123  the
 126  124  .Xr mdoc 5
 127  125  parser is used; otherwise, the
 128  126  .Xr man 5
 129  127  parser is used.
 130  128  With other arguments,
 131  129  .Fl m
 132  130  is silently ignored.
 133  131  .It Fl O Ar options
 134  132  Comma-separated output options.
      133 +See the descriptions of the individual output formats for supported
      134 +.Ar options .
 135  135  .It Fl T Ar output
 136      -Output format.
 137      -See
 138      -.Sx Output Formats
 139      -for available formats.
 140      -Defaults to
 141      -.Fl T Cm locale .
      136 +Select the output format.
      137 +Supported values for the
      138 +.Ar output
      139 +argument are
      140 +.Cm ascii ,
      141 +.Cm html ,
      142 +the default of
      143 +.Cm locale ,
      144 +.Cm man ,
      145 +.Cm markdown ,
      146 +.Cm pdf ,
      147 +.Cm ps ,
      148 +.Cm tree ,
      149 +and
      150 +.Cm utf8 .
      151 +.Pp
      152 +The special
      153 +.Fl T Cm lint
      154 +mode only parses the input and produces no output.
      155 +It implies
      156 +.Fl W Cm all
      157 +and redirects parser messages, which usually appear on standard
      158 +error output, to standard output.
 142  159  .It Fl W Ar level
 143  160  Specify the minimum message
 144  161  .Ar level
 145  162  to be reported on the standard error output and to affect the exit status.
 146  163  The
 147  164  .Ar level
 148  165  can be
 149  166  .Cm base ,
 150  167  .Cm style ,
 151  168  .Cm warning ,
↓ open down ↓ 37 lines elided ↑ open up ↑
 189  206  to exit after parsing a file that causes warnings or errors of at least
 190  207  the requested level.
 191  208  No formatted output will be produced from that file.
 192  209  If both a
 193  210  .Ar level
 194  211  and
 195  212  .Cm stop
 196  213  are requested, they can be joined with a comma, for example
 197  214  .Fl W Cm error , Ns Cm stop .
 198  215  .It Ar file
 199      -Read input from zero or more files.
 200      -If unspecified, reads from stdin.
 201      -If multiple files are specified,
      216 +Read from the given input file.
      217 +If multiple files are specified, they are processed in the given order.
      218 +If unspecified,
 202  219  .Nm
 203      -will halt with the first failed parse.
      220 +reads from standard input.
 204  221  .El
 205      -.Ss Output Formats
 206      -The
 207      -.Nm
 208      -utility accepts the following
 209      -.Fl T
 210      -arguments, which correspond to output modes:
 211      -.Bl -tag -width "-T markdown"
 212      -.It Fl T Cm ascii
 213      -Produce 7-bit ASCII output.
 214      -See
 215      -.Sx ASCII Output .
 216      -.It Fl T Cm html
 217      -Produce HTML5, CSS1, and MathML output.
 218      -See
 219      -.Sx HTML Output .
 220      -.It Fl T Ns Cm lint
 221      -Parse only: produce no output.
 222      -Implies
 223      -.Fl W Cm all
 224      -and redirects parser messages, which usually appear
 225      -on standard error output, to standard output.
 226      -.It Fl T Cm locale
 227      -Encode output using the current locale.
 228      -This is the default.
 229      -See
 230      -.Sx Locale Output .
 231      -.It Fl T Cm man
 232      -Produce
 233      -.Xr man 5
 234      -format output.
 235      -See
 236      -.Sx Man Output .
 237      -.It Fl T Cm markdown
 238      -Produce output in
 239      -.Sy markdown
 240      -format.
 241      -See
 242      -.Sx Markdown Output .
 243      -.It Fl T Cm pdf
 244      -Produce PDF output.
 245      -See
 246      -.Sx PDF Output .
 247      -.It Fl T Cm ps
 248      -Produce PostScript output.
 249      -See
 250      -.Sx PostScript Output .
 251      -.It Fl T Cm tree
 252      -Produce an indented parse tree.
 253      -.It Fl T Cm utf8
 254      -Encode output in the UTF\-8 multi-byte format.
 255      -See
 256      -.Sx UTF\-8 Output .
 257      -.El
 258      -.Pp
 259      -If multiple input files are specified, these will be processed by the
 260      -corresponding filter in-order.
 261  222  .Ss ASCII Output
 262      -Output produced by
      223 +Use
 263  224  .Fl T Cm ascii
 264      -is rendered in standard 7-bit ASCII documented in
 265      -.Xr ascii 5 .
      225 +to force text output in 7-bit ASCII character encoding documented in the
      226 +.Xr ascii 5
      227 +manual page, ignoring the
      228 +.Xr locale 1
      229 +set in the environment.
 266  230  .Pp
 267  231  Font styles are applied by using back-spaced encoding such that an
 268  232  underlined character
 269  233  .Sq c
 270  234  is rendered as
 271  235  .Sq _ Ns \e[bs] Ns c ,
 272  236  where
 273  237  .Sq \e[bs]
 274  238  is the back-space character number 8.
 275  239  Emboldened characters are rendered as
 276  240  .Sq c Ns \e[bs] Ns c .
 277  241  .Pp
 278  242  The special characters documented in
 279  243  .Xr mandoc_char 5
 280  244  are rendered best-effort in an ASCII equivalent.
 281  245  .Pp
 282      -Output width is limited to 78 visible columns unless literal input lines
 283      -exceed this limit.
 284      -.Pp
 285  246  The following
 286  247  .Fl O
 287  248  arguments are accepted:
 288  249  .Bl -tag -width Ds
 289  250  .It Cm indent Ns = Ns Ar indent
 290  251  The left margin for normal text is set to
 291  252  .Ar indent
 292  253  blank characters instead of the default of five for
 293  254  .Xr mdoc 5
 294  255  and seven for
 295  256  .Xr man 5 .
 296  257  Increasing this is not recommended; it may result in degraded formatting,
 297  258  for example overfull lines or ugly line breaks.
      259 +When output is to a pager on a terminal that is less than 66 columns
      260 +wide, the default is reduced to three columns.
      261 +.It Cm mdoc
      262 +Format
      263 +.Xr man 5
      264 +input files in
      265 +.Xr mdoc 5
      266 +output style.
      267 +Specifically, this suppresses the two additional blank lines near the
      268 +top and the bottom of each page, and it implies
      269 +.Fl O Cm indent Ns =5 .
      270 +One useful application is for checking that
      271 +.Fl T Cm man
      272 +output formats in the same way as the
      273 +.Xr mdoc 5
      274 +source it was generated from.
 298  275  .It Cm width Ns = Ns Ar width
 299  276  The output width is set to
 300      -.Ar width .
      277 +.Ar width
      278 +instead of the default of 78.
      279 +When output is to a pager on a terminal that is less than 79 columns
      280 +wide, the default is reduced to one less than the terminal width.
      281 +In any case, lines that are output in literal mode are never wrapped
      282 +and may exceed the output width.
 301  283  .El
 302  284  .Ss HTML Output
 303  285  Output produced by
 304  286  .Fl T Cm html
 305  287  conforms to HTML5 using optional self-closing tags.
 306  288  Default styles use only CSS1.
 307  289  Equations rendered from
 308  290  .Xr eqn 5
 309  291  blocks use MathML.
 310  292  .Pp
 311  293  The
 312  294  .Pa mandoc.css
 313  295  file documents style-sheet classes available for customising output.
 314  296  If a style-sheet is not specified with
 315  297  .Fl O Cm style ,
 316  298  .Fl T Cm html
 317  299  defaults to simple output (via an embedded style-sheet)
 318  300  readable in any graphical or text-based web
 319  301  browser.
 320  302  .Pp
 321      -Special characters are rendered in decimal-encoded UTF\-8.
      303 +Non-ASCII characters are rendered
      304 +as hexadecimal Unicode character references.
 322  305  .Pp
 323  306  The following
 324  307  .Fl O
 325  308  arguments are accepted:
 326  309  .Bl -tag -width Ds
 327  310  .It Cm fragment
 328  311  Omit the <!DOCTYPE> declaration and the <html>, <head>, and <body>
 329  312  elements and only emit the subtree below the <body> element.
 330  313  The
 331  314  .Cm style
↓ open down ↓ 29 lines elided ↑ open up ↑
 361  344  The default is not to
 362  345  present a hyperlink.
 363  346  .It Cm style Ns = Ns Ar style.css
 364  347  The file
 365  348  .Ar style.css
 366  349  is used for an external style-sheet.
 367  350  This must be a valid absolute or
 368  351  relative URI.
 369  352  .El
 370  353  .Ss Locale Output
 371      -Locale-depending output encoding is triggered with
      354 +By default,
      355 +.Nm
      356 +automatically selects UTF-8 or ASCII output according to the current
      357 +.Xr locale 1 .
      358 +If any of the environment variables
      359 +.Ev LC_ALL ,
      360 +.Ev LC_CTYPE ,
      361 +or
      362 +.Ev LANG
      363 +are set and the first one that is set
      364 +selects the UTF-8 character encoding, it produces
      365 +.Sx UTF-8 Output ;
      366 +otherwise, it falls back to
      367 +.Sx ASCII Output .
      368 +This output mode can also be selected explicitly with
 372  369  .Fl T Cm locale .
 373      -This is the default.
 374  370  .Ss Man Output
 375      -Translate input format into
      371 +Use
      372 +.Fl T Cm man
      373 +to translate
      374 +.Xr mdoc 5
      375 +input into
 376  376  .Xr man 5
 377  377  output format.
 378  378  This is useful for distributing manual sources to legacy systems
 379  379  lacking
 380  380  .Xr mdoc 5
 381  381  formatters.
 382  382  .Pp
 383      -If
 384      -.Xr mdoc 5
 385      -is passed as input, it is translated into
 386      -.Xr man 5 .
 387      -If the input format is
      383 +If the input format of a file is
 388  384  .Xr man 5 ,
 389  385  the input is copied to the output, expanding any
 390  386  .Xr mandoc_roff 5
 391  387  .Ic so
 392  388  requests.
 393  389  The parser is also run, and as usual, the
 394  390  .Fl W
 395  391  level controls which
 396  392  .Sx DIAGNOSTICS
 397  393  are displayed before copying the input to the output.
 398  394  .Ss Markdown Output
 399      -Translate
      395 +Use
      396 +.Fl T Cm markdown
      397 +to translate
 400  398  .Xr mdoc 5
 401      -input to the
 402      -.Sy markdown
 403      -format conforming to
      399 +input to the markdown format conforming to
 404  400  .Lk http://daringfireball.net/projects/markdown/syntax.text\
 405  401   "John Gruber's 2004 specification" .
 406  402  The output also almost conforms to the
 407  403  .Lk http://commonmark.org/ CommonMark
 408  404  specification.
 409  405  .Pp
 410  406  The character set used for the markdown output is ASCII.
 411  407  Non-ASCII characters are encoded as HTML entities.
 412  408  Since that is not possible in literal font contexts, because these
 413  409  are rendered as code spans and code blocks in the markdown output,
↓ open down ↓ 50 lines elided ↑ open up ↑
 464  460  .Ar legal ,
 465  461  or
 466  462  .Ar letter .
 467  463  You may also manually specify dimensions as
 468  464  .Ar NNxNN ,
 469  465  width by height in millimetres.
 470  466  If an unknown value is encountered,
 471  467  .Ar letter
 472  468  is used.
 473  469  .El
 474      -.Ss UTF\-8 Output
      470 +.Ss UTF-8 Output
 475  471  Use
 476  472  .Fl T Cm utf8
 477      -to force a UTF\-8 locale.
      473 +to force text output in UTF-8 multi-byte character encoding,
      474 +ignoring the
      475 +.Xr locale 1
      476 +settings in the environment.
 478  477  See
 479      -.Sx Locale Output
 480      -for details and options.
      478 +.Sx ASCII Output
      479 +regarding font styles and
      480 +.Fl O
      481 +arguments.
      482 +.Pp
      483 +On operating systems lacking locale or wide character support, and
      484 +on those where the internal character representation is not UCS-4,
      485 +.Nm
      486 +always falls back to
      487 +.Sx ASCII Output .
 481  488  .Ss Syntax tree output
 482  489  Use
 483  490  .Fl T Cm tree
 484  491  to show a human readable representation of the syntax tree.
 485  492  It is useful for debugging the source code of manual pages.
 486  493  The exact format is subject to change, so don't write parsers for it.
 487  494  .Pp
 488  495  The first paragraph shows meta data found in the
 489  496  .Xr mdoc 5
 490  497  prologue, on the
↓ open down ↓ 46 lines elided ↑ open up ↑
 537  544  The following
 538  545  .Fl O
 539  546  argument is accepted:
 540  547  .Bl -tag -width Ds
 541  548  .It Cm noval
 542  549  Skip validation and show the unvalidated syntax tree.
 543  550  This can help to find out whether a given behaviour is caused by
 544  551  the parser or by the validator.
 545  552  Meta data is not available in this case.
 546  553  .El
      554 +.Sh ENVIRONMENT
      555 +.Bl -tag -width Ev
      556 +.It Ev LC_CTYPE
      557 +The character encoding
      558 +.Xr locale 1 .
      559 +When
      560 +.Sx Locale Output
      561 +is selected, it decides whether to use ASCII or UTF-8 output format.
      562 +It never affects the interpretation of input files.
      563 +.El
 547  564  .Sh EXIT STATUS
 548  565  The
 549  566  .Nm
 550  567  utility exits with one of the following values, controlled by the message
 551  568  .Ar level
 552  569  associated with the
 553  570  .Fl W
 554  571  option:
 555  572  .Pp
 556  573  .Bl -tag -width Ds -compact
↓ open down ↓ 120 lines elided ↑ open up ↑
 677  694  formatting nor portability are in danger.
 678  695  While great care is taken to avoid false positives on the higher
 679  696  message levels, the
 680  697  .Cm style
 681  698  level tries to reduce the probability that issues go unnoticed,
 682  699  so it may occasionally issue bogus suggestions.
 683  700  Please use your good judgement to decide whether any particular
 684  701  .Cm style
 685  702  suggestion really justifies a change to the input file.
 686  703  .It Cm base
 687      -A convertion used in the base system of a specific operating system
      704 +A convention used in the base system of a specific operating system
 688  705  is not adhered to.
 689  706  These are not markup mistakes, and neither the quality of formatting
 690  707  nor portability are in danger.
 691  708  Messages of the
 692  709  .Cm base
 693  710  level are printed with the more intuitive
 694  711  .Cm style
 695  712  .Ar level
 696  713  tag.
 697  714  .El
↓ open down ↓ 87 lines elided ↑ open up ↑
 785  802  .Ic \&Dd
 786  803  macro uses the legacy
 787  804  .Xr man 5
 788  805  date format
 789  806  .Dq yyyy-dd-mm .
 790  807  Consider using the conventional
 791  808  .Xr mdoc 5
 792  809  date format
 793  810  .Dq "Month dd, yyyy"
 794  811  instead.
      812 +.It Sy "normalizing date format to" : No ...
      813 +.Pq mdoc , man
      814 +The
      815 +.Ic \&Dd
      816 +or
      817 +.Ic \&TH
      818 +macro provides an abbreviated month name or a day number with a
      819 +leading zero.
      820 +In the formatted output, the month name is written out in full
      821 +and the leading zero is omitted.
 795  822  .It Sy "lower case character in document title"
 796  823  .Pq mdoc , man
 797  824  The title is still used as given in the
 798  825  .Ic \&Dt
 799  826  or
 800  827  .Ic \&TH
 801  828  macro.
 802  829  .It Sy "duplicate RCS id"
 803  830  A single manual page contains two copies of the RCS identifier for
 804  831  the same operating system.
 805  832  Consider deleting the later instance and moving the first one up
 806  833  to the top of the page.
 807      -.It Sy "typo in section name"
      834 +.It Sy "possible typo in section name"
 808  835  .Pq mdoc
 809  836  Fuzzy string matching revealed that the argument of an
 810  837  .Ic \&Sh
 811  838  macro is similar, but not identical to a standard section name.
 812  839  .It Sy "unterminated quoted argument"
 813  840  .Pq roff
 814  841  Macro arguments can be enclosed in double quote characters
 815  842  such that space characters and macro names contained in the quoted
 816  843  argument need not be escaped.
 817  844  The closing quote of the last argument of a macro can be omitted.
↓ open down ↓ 56 lines elided ↑ open up ↑
 874  901  request occurs even though the document is still in fill mode,
 875  902  or already switched back to fill mode.
 876  903  It has no effect.
 877  904  .It Sy "fill mode already disabled, skipping"
 878  905  .Pq man
 879  906  An
 880  907  .Ic \&nf
 881  908  request occurs even though the document already switched to no-fill mode
 882  909  and did not switch back to fill mode yet.
 883  910  It has no effect.
      911 +.It Sy "verbatim \(dq--\(dq, maybe consider using \e(em"
      912 +.Pq mdoc
      913 +Even though the ASCII output device renders an em-dash as
      914 +.Qq \-\- ,
      915 +that is not a good way to write it in an input file
      916 +because it renders poorly on all other output devices.
 884  917  .It Sy "function name without markup"
 885  918  .Pq mdoc
 886  919  A word followed by an empty pair of parentheses occurs on a text line.
 887  920  Consider using an
 888  921  .Ic \&Fn
 889  922  or
 890  923  .Ic \&Xr
 891  924  macro.
 892  925  .It Sy "whitespace at end of input line"
 893  926  .Pq mdoc , man , roff
↓ open down ↓ 1191 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX