summaryrefslogtreecommitdiffstats
path: root/mdoc_markdown.c
Commit message (Collapse)AuthorAgeFilesLines
* Support two-character font names (BI, CW, CR, CB, CI)Ingo Schwarze2021-08-101-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | in the tbl(7) layout font modifier. Get rid of the TBL_CELL_BOLD and TBL_CELL_ITALIC flags and use the usual ESCAPE_FONT* enum mandoc_esc members from mandoc.h instead, which simplifies and unifies some code. While here, also support CB and CI in roff(7) \f escape sequences and in roff(7) .ft requests for all output modes. Using those is certainly not recommended because portability is limited even with groff, but supporting them makes some existing third-party manual pages look better, in particular in HTML output mode. Bug-compatible with groff as far as i'm aware, except that i consider font names starting with the '\n' (ASCII 0x0a line feed) character so insane that i decided to not support them. Missing feature reported by nabijaczleweli dot xyz in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=992002. I used none of the code from the initial patch submitted by nabijaczleweli, but some of their ideas. Final patch tested by them, too.
* Because mandoc_aux.h and mandoc.h use __attribute__, all files thatIngo Schwarze2020-06-221-0/+2
| | | | | | | | include mandoc_aux.h or mandoc.h need to include config.h, too. It is suspected that for example IRIX needs this, or it is likely to throw errors in these files because the system compiler doesn't understand __attribute__. Issue reported by Kazuo Kuroi <kazuo at irixnet dot org>.
* Remove some stray argument names from function prototypes,Ingo Schwarze2020-04-031-5/+7
| | | | | | for consistency with the dominant style used in mandoc. No functional change. Patch from Martin Vahlensieck <academicsolutions dot ch>.
* Introduce the concept of nodes that are semantically transparent:Ingo Schwarze2020-02-271-12/+24
| | | | | | | | | | | | | | they are skipped when looking for previous or following high-level macros. Examples include roff(7) .ft, .ll, and .ta, mdoc(7) .Sm and .Tg, and man(7) .DT and .PD. Use this concept for a variety of improved decisions in various validators and formatters. While here, * remove a few const qualifiers on struct arguments that caused trouble; * get rid of some more Yoda notation in the vicinity; * and apply some other stylistic improvements in the vicinity. I found this class of issues while considering .Tg patches from kn@.
* bugfix: .Tg must be ignored completely in these output modesIngo Schwarze2020-02-201-1/+1
|
* Introduce a new mdoc(7) macro .Tg ("tag") to explicitly mark a placeIngo Schwarze2020-01-191-0/+1
| | | | | | | | | | | | | | | as defining a term. Please only use it when automatic tagging does not work. Manual page authors will not be required to add the new macro; using it remains optional. HTML output is still rudimentary in this version and will be polished later. Thanks to kn@ for reminding me that i have been considering since BSDCan 2014 whether something like this might be useful. Given that possibilities of making automatic tagging better are running out and there are still several situations where automatic tagging cannot do the job, i think the time is now ripe. Feedback and no objection from millert@; OK espie@ inoguchi@ kn@.
* delete trailing whitespace and space-tab sequences; no code change;Ingo Schwarze2019-07-011-1/+1
| | | | | patch from Michal Nowak <mnowak at startmail dot com> who found these with git pbchk in the illumos tree
* Cleanup, no functional change:Ingo Schwarze2018-12-301-9/+9
| | | | | | | | | | | | | | The struct roff_man used to be a bad mixture of internal parser state and public parsing results. Move the public results to the parsing result struct roff_meta, which is already public. Move the rest of struct roff_man to the parser-internal header roff_int.h. Since the validators need access to the parser state, call them from the top level parser during mparse_result() rather than from the main programs, also reducing code duplication. This keeps parser internal state out of thee main programs (five in mandoc portable) and out of eight formatters.
* Several improvements to escape sequence handling.Ingo Schwarze2018-12-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | * Add the missing special character \_ (underscore). * Partial implementations of \a (leader character) and \E (uninterpreted escape character). * Parse and ignore \r (reverse line feed). * Add a WARNING message about undefined escape sequences. * Add an UNSUPP message about unsupported escape sequences. * Mark \! and \? (transparent throughput) and \O (suppress output) as unsupported. * Treat the various variants of zero-width spaces as one-byte escape sequences rather than as special characters, to avoid defining bogus forms with square brackets. * For special characters with one-byte names, do not define bogus forms with square brackets, except for \[-], which is valid. * In the form with square brackets, undefined special characters do not fall back to printing the name verbatim, not even for one-byte names. * Starting a special character name with a blank is an error. * Undefined escape sequences never abort formatting of the input string, not even in HTML output mode. * Document the newly handled escapes, and a few that were missing. * Regression tests for most of the above.
* In the validators, translate obsolete macro aliases (Lp, Ot, LP, P)Ingo Schwarze2018-12-031-2/+10
| | | | | | to the standard forms (Pp, Ft, PP) up front, such that later code does not need to look for the obsolete versions. This reduces the risk of incomplete handling.
* Implement the \f(CW and \f(CR (constant width font) escape sequencesIngo Schwarze2018-10-251-0/+1
| | | | | | | | | for HTML output. Somewhat relevant because pod2man(1) relies on this. Missing feature reported by Pali dot Rohar at gmail dot com. Note that constant width font was already correctly selected before this when required by semantic markup. Only attempting physical markup with the low-level escape sequence was ineffective.
* Remove more pointer arithmetic passing via regions outside the arrayIngo Schwarze2018-08-171-8/+15
| | | | | that is undefined according to the C standard. Robert Elz <kre at munnari dot oz dot au> pointed out i wasn't quite done yet.
* Implement the \*(.T predefined string (interpolate device name)Ingo Schwarze2018-08-161-1/+4
| | | | | by allowing the preprocessor to pass it through to the formatters. Used for example by the groff_char(7) manual page.
* preserve comments before .Dd when converting mdoc(7) to man(7)Ingo Schwarze2018-04-111-1/+1
| | | | with mandoc -Tman; suggested by Thomas Klausner <wiz at NetBSD>
* implement the roff(7) \p (break output line) escape sequenceIngo Schwarze2017-06-141-1/+12
|
* fix formatting of intermediate punctuation in .LkIngo Schwarze2017-05-301-6/+12
|
* Move .sp to the roff modules. Enough infrastructure is in placeIngo Schwarze2017-05-051-1/+3
| | | | now that this actually saves code: -70 LOC.
* move .ll to the roff modulesIngo Schwarze2017-05-051-5/+1
|
* Move handling of the roff(7) .ft request from the man(7)Ingo Schwarze2017-05-051-1/+4
| | | | | modules to the new roff(7) modules. As a side effect, mdoc(7) now handles .ft, too. Of course, do not use that.
* Parser reorg:Ingo Schwarze2017-05-041-6/+12
| | | | | Generate the first node on the roff level: .br Fix some column numbers in diagnostic messages while here.
* Continue parser unification:Ingo Schwarze2017-04-241-3/+3
| | | | | | | | * Make enum rofft an internal interface as enum roff_tok in "roff.h". * Represent mdoc and man macros in enum roff_tok. * Make TOKEN_NONE a proper enum value and use it throughout. * Put the prologue macros first in the macro tables. * Unify mdoc_macroname[] and man_macroname[] into roff_name[].
* Fix handling of trailing punctuation in .Lk.Ingo Schwarze2017-04-171-3/+14
| | | | | | | | | This macro is unusual in so far as trailing punction needs to remain inside the scope because it must be inside, not after the display of long URIs in terminal output mode. Improves formatting of fw_update(1), help(1), less(1), sendbug(1), acx(4), inet6(4), ipsec(4), oce(4), isakmpd.conf(5), afterboot(8), release(8), traceroute(8).
* In markdown, autolinks are dangerous. Different compilers disagreeIngo Schwarze2017-03-111-21/+48
| | | | | | | | | | | with respect to what constitutes a valid autolink, and if a compiler deems an autolink invalid, the input turns into an unintended and potentially harmful raw HTML tag. So, never write autolinks. Instead of <link>, write [link](link). Instead of <addr>, write [addr](mailto:addr). Issue pointed out by bentley@, who also agrees with the general direction of the change.
* The CommonMark specification wants that opening parenthesesIngo Schwarze2017-03-081-9/+2
| | | | | inside link destinations be escaped. While here, remove the obsolete ESC_PAR.
* According to the CommonMark specification, backslash escapesIngo Schwarze2017-03-081-0/+4
| | | | and markdown markup do not work inside code spans.
* The CommonMark specification allows list markers fo the form "number) "Ingo Schwarze2017-03-081-1/+1
| | | | | as well as "number. ", so escape closing parentheses after leading digits to improve portability.
* Do not increment .Bl -enum list markers beyond two digits.Ingo Schwarze2017-03-081-1/+3
| | | | | Otherwise, we would indent subsequent paragraphs less than the CommonMark specification requires, harming portability.
* .Bl -column never gets blank lines between rowsIngo Schwarze2017-03-081-1/+5
|
* Add a blank after ">" when quoting.Ingo Schwarze2017-03-081-1/+7
| | | | If is allowed by markdown syntax and more human-readable.
* Escape blanks at the end of markdown linesIngo Schwarze2017-03-071-11/+22
| | | | such that they don't look like output line breaks.
* fix completely empty .Eo: no blank line wantedIngo Schwarze2017-03-071-8/+4
|
* fix spacing after empty .FlIngo Schwarze2017-03-071-1/+11
|
* implement .An -split and -nosplitIngo Schwarze2017-03-071-1/+30
|
* Fix .In formatting in the SYNOPSIS:Ingo Schwarze2017-03-071-9/+6
| | | | No &zwnj; in the middle of **, please.
* URIs need different escaping; reported by reyk@Ingo Schwarze2017-03-061-3/+12
|
* Remove a redundant condition in .%T handling, no functional change.Ingo Schwarze2017-03-041-4/+2
| | | | Found by jsg@ with scan-build.
* new -mdoc -Tmarkdown output mode; OK millert@ reyk@ tb@;Ingo Schwarze2017-03-031-0/+1448
thanks to reyk@ and to Vsevolod at FreeBSD for suggesting it