md2roff - converts markdown documents to roff (man, mdoc, ms, mm, mom).
md2roff [{-n[-z]|-d|-m|-o}] [FILE] [-]
md2roff converts the input files to groff (with man package) format
and prints the result to stdout. If the FILE is -
then it reads
from stdin.
displays a short-help text and exits
displays the program version, copyright and license information and exists.
use man package (linux man pages, default), see groff_man 7.
use ms package, see groff_ms 7.
use mm package, see groff_mm 7.
use mdoc package (BSD man pages), see groff_mdoc 7.
use mom package, see groff_mom 7.
For man-page only. specify the style of the SYNOPSIS. Where X, 0 = default, 1 = md2roff highlight, 2 = .SY/.OP commands, 3 = .Nm commands.
try to use rules of man-pages 7.
- If the documents starts with
#
then creates the TH command with this; otherwise there will be a default TH with the file-name. Actually only the title (name) and section are required. See man-pages 7.
... example
# title section date source manual
... sed manual page:
# SED 1 "January 2020" "sed 4.8" "User Commands"
-
If you write man page, use
####
for each option to automatically convert the section to '.TP' as in GNU's manuals. Also this enables 'COMMAND' (see 4) style for this line only and only in man-page output mode. -
Use special link type (man) to link man pages. Example, link to tcsh 1.
... link to [tcsh 1](man) ...
-
For man modes, there is a special keyword
COMMAND:
in SYNOPSIS section that enables the syntax commands (command and options in bold, separators/syntax-symbols in no-color, parameters in italics). COMMAND takes one text string as parameter which is the full expression of the syntax. For multi-line use special character backslash at the end of the line. This is same to--synopsis-style=1
-
For man and mdoc modes, there is a special keyword
SYNTAX:
in SYNOPSIS section that enables the syntax commands (.SY/.OP/.YS). Each line starts with-
translated to .OP otherwise to .RI, except the first which is the command name. This is same to--synopsis-style=2
## SYNOPSIS
SYNTAX:
appname
-x arg
-y [arg]
A lot. Fix and send.
View a markdown as console man page:
$ md2roff mytext.md | groff -Tutf8 -man | $PAGER
View a markdown as postscript man page:
$ md2roff mytext.md | groff -Tps -man | okular -
This document is example, its written in markdown and produce a nice man page. You can see the man page as exported to pdf (by groff) in this directory.
https://github.com/nereusx/md2roff
Copyright (C) 2017-2021 Nicholas Christopoulos [email protected].
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
Written by Nicholas Christopoulos.
groff_man 7, man-pages 7, groff_man 7, groff_mdoc 7, groff_mm 7, groff_mom 7, groff_ms 7.