| LOWDOWN-DIFF(1) | General Commands Manual | LOWDOWN-DIFF(1) |
lowdown-diff —
view differences in markdown files
lowdown-diff |
[input_options] [output_options] [-s]
[-M metadata]
[-m metadata]
[-o file]
[-t mode]
oldfile [newfile] |
Shows differences between lowdown(5) documents as formatted output. Results are written to standard output.
The short arguments are as follows:
-s-M
metadata-m and what's parsed from the
document. See Metadata.-m
metadata-M, but overridden by what's parsed the
document, then -M.-o
file-t
mode, -T
mode-ms package and needing table support,
term for ANSI-compatible UTF-8 terminal output,
man for roff output using the classic
-man package, tree, to show
the parse tree of the input document, and null to
parse the document but do no rendering. See
Output media. The
-T mode form is retained for
backward compatibility.The following are long options for input parsing. These affect the parse tree passed to all outputs.
--parse-hilite--parse-math--parse-maxdepth=depth--parse-no-autolinkhttp, https,
ftp, mailto, and relative
links or link fragments.--parse-no-cmark--parse-no-codeindent--parse-no-callouts--parse-no-deflists--parse-no-ext-attrs--parse-no-fenced--parse-no-footnotes--parse-no-img-ext--parse-no-ext-attrs.--parse-no-intraemph--parse-no-mantitle--parse-no-metadata-m or -M.--parse-no-strike--parse-no-super--parse-no-tables--parse-no-tasklists--parse-super-shortThere are many output long options. The following are shared by all output media:
--out-standalone-s.--out-no-smarty--template
template-s output, use a
template file. See Templates.
Currently only for -tgemini,
-thtml,
-tlatex,
-tman,
-tms, and
-ttree.What follows are per-output long options. For HTML with
-thtml, these are as
follows:
--html-callout-mdn,
--html-callout-gfm--html-hardwrap--html-no-escapehtml--html-no-skiphtml has been specified, this
causes embedded HTML not to be escaped, and is instead output verbatim.
This has no effect if --html-no-skiphtml has not
been specified.--html-no-head-idsid attributes for headers.--html-no-num-ent--html-no-owasp--html-no-skiphtml--html-no-escapehtml.--html-titleblockFor both roff formats
-tman and
-tms (unless as noted), the
following apply:
--roff-code-font=fontsB,B,BI,BI uses bold (“B”) instead of
a constant-width. Not specifying a font will use the default, as will
specifying a zero-length font name. Aliases none,
bold, and code set no
special fonts, bold, and the default constant-width.--roff-endnotes-tms, as
-tman only supports
endnotes.--roff-no-numbered.NH NN). Only
applies to -tms.--roff-no-skiphtml--roff-no-links--roff-short-links for images and links. Only
applies when --roff-traditional is specified.--roff-short-links--roff-traditional
is specified.--roff-traditional.pdfhref,
.UR, .MT), multi-page
tables (.TS H, .TH),
Unicode sequence syntax (\[uNNNN]), example block
macros (.EX), modern section headings
(.NH NN, .SH NN,
.pdfhref O NN), or intra-document links
(.pdfhref L). The output is compatible with
traditional troff(1).The argument prefix --nroff, such as in
--nroff-traditional, is deprecated in favour of
--roff.
The -tterm output
has the following:
--term-all-metadata-s is specified, output all metadata instead of
just the title, author, and date.--term-columns=columns--term-hmargin=margin--term-columns after subtracting
--term-width.--term-hpadding=padding--term-width.--term-no-ansi--term-no-colour.--term-no-colour--term-no-links--term-short-links and
--term-no-rellinks.--term-no-rellinks--term-short-links.--term-short-links--term-vmargin=margin--term-width=width--term-hpadding). This may be exceeded by literal
text. If zero or unset, defaults to --term-columns
or 80 at most. Truncates to --term-columns.The -tgemini output
has several flags that control the placement of links. By default, links
(images, autolinks, and links) are queued when specified in-line then
emitted in a block sequence after the nearest block element.
--gemini-link-end--gemini-link-inline--gemini-link-noref--gemini-link-roman.--gemini-link-roman--gemini-metadataThe -tlatex output
has the following options:
--latex-no-numbered--latex-no-skiphtmlThe -tfodt output
has the following options:
--odt-no-skiphtml--odt-style=file<office:font-face-decls>,
<office:scripts>, and
<office:styles> XML elements in the root of
the document. This is not syntax-checked in any way.The output media is specified by -t, which
defaults to -thtml.
-tfodt-tgemini-thtml-tlatexamsmath and amssymb for
maths, graphicx for images,
inputenc (utf8) for UTF-8 input,
fontend (T1) and textcomp
for output glyphs, lmodern for Latin modern font,
xcolor for the difference engine output, and
hyperref for links.-tman-tms-tterm-ttreeThe differences between old and new document are illustrated in the following ways:
-tfodt-tgemini-tlatex-tman-tms-tterm-ttreeDifferences in content metadata use the following rule: deleted metadata key-value pairs are not processed in the output, so only inserted or retained metadata are processed.
When -s is specified, the formatted
content is serialised into a self-contained document template as defined by
the output type.
If not explicitly set with --template, a
default template is produced as follows:
-tfodt<office:document> and prologue
<office:automatic-styles>,
<office:master-styles>, and
<office:body>.-thtml<html> with optional language, then
<head>. In order, the
<head> consists of charset and viewport
<meta> elements; optional
<meta> elements from metadata affiliation
(creator), author, copyright, and date; optional CSS sources from
metadata; optional JavaScript sources from metadata; the possibly-empty
<title>; then optional arbitrary content
from metadata HTML header.-tlatexdocumentclass and
usepackage statements, optional arbitrary content
from metadata LaTeX header, then surrounding
begin{document} statements.-tman,
-tms-tterm-ttreeSee Metadata for metadata values used by the default template.
Metadata keys are canonicalised and de-deduplicated in the
following order: -m (overridden by document content
and -M), the prologue of the document itself, then
-M (overriding document content and
-m).
After de-duplication, metadata is serialised into document
variables and/or standalone -s output.
When not using --template, the following
metadata keys are used in the default -s
template:
affiliation-thtml,
-tlatex, and
-tms.rcsauthor.
Used in -tfodt,
-thtml,
-tlatex,
-tms, and
-tterm.baseheaderlevelshiftheadinglevelby.copyright-tms and
-thtml.css<link
rel="stylesheet" href="..." /> statement.
Multiple CSS files (in order) may be separated by two or more spaces
(including newlines) and are output in the given order. Only used in
-thtml.datercsdate. Used in
-tfodt,
-thtml,
-tlatex,
-tman,
-tms, and
-tterm.htmlheader-thtml and with
-s. This metadata is not processed: it's passed
unchanged into the output.javascript<script src="..."></script>
statement. Multiple script files (in order) may be separated by two or
more spaces (including newlines) and are output in the given order. Only
used in -thtml.lang-thtml.latexheaderbegin{document}. Only used in
-tlatex and with
-s. This metadata is not processed: it's passed
unchanged into the output.manheader.TH macro. Only used in
-tman and with
-s. This metadata is not processed: it's passed
unchanged into the output.msheader.TL macro. Only used in
-tms and with
-s. This metadata is not processed: it's passed
unchanged into the output.author, but in RCS author format. Overrides
author.rcsdatedate, but in RCS date format. Overrides
date.section-tman.shiftheadinglevelbybaseheaderlevel. If unset or not a valid number,
defaults to zero. Used in
-tfodt,
-thtml,
-tlatex,
-tman, and
-tms.source-tman.volume-tman.title-tfodt,
-thtml,
-tlatex,
-tman,
-tms, and
-tterm.Default values, such “7” for the
section, are not set as metadata values, and will
not appear if the metadata key is used as a variable.
Some output media accept a template
(--template) to customise standalone
(-s) output. Parsed input content is filled into
templates through control statements that support conditionals, loops, and
variable transformation sequences.
Control statements are delimited as
$statement$ or ${statement}.
Arbitrary white-space may surround the case-insensitive statement between
matching delimiters. Statements without a closing delimiter are considered
opaque text.
The following statements are available:
$$,
${}$. This may contain arbitrary
white-space.$ifdef(expression)$ifdef and the opening parenthesis. Begins a block
that is ended by a else,
endif, or the end of file. Its contents are output
only if expression evaluates to a non-empty
string.$else$endif or end of
file. Its contents are output only if the condition of a preceding
ifdef evaluates to an empty string. An
else without a preceding
ifdef is not output.$endif$ifdef or
else. If not preceded by one of those statements,
is silently ignored.$for(expression)$for and the opening parenthesis. Begins a block
that is ended by an endfor or the end of file.
Block contents contents are repeatedly output for each list item evaluated
from expression. The anaphoric keyword
this may be used to access the current loop
expression within the block.$expression$If a control statement ends with two consecutive hyphens before the closing delimiter, input is consumed up to and including the next newline or until end of file. This allows for line-sensitive output media to use control statements without superfluous blank lines.
Expressions consist of
initial[([arg]*)]?[.transform[([arg]*)]?]*or an initial value accepting optional arguments followed by an optional series of transforms accepting optional arguments. If an argument list is empty or not provided, it evaluates to an empty list.
The initial value is one of the
following:
and(expression[,expression]*)true if all
expressions evaluate to non-empty lists, otherwise an empty list. An empty
expression evaluates to an empty list."literal string""foo\"bar".bodybodymeta(key)key. Allows for keys that are also keywords like
body or endif.not(expression)true if the
expression evaluates as an empty list, otherwise an empty list.or(expression[,expression]*)true if one
expression evaluates to non-empty lists, otherwise an empty list. An empty
expression evaluates to an empty list.thisIf a metadata key is not specified in the input, or if the
anaphoric this has not initialised by a looping
context, the initial value evaluates to an empty list. Otherwise, the value
is a singleton list.
If transforms are invalid, they will transform into an empty list.
The following transformations are available:
escapegemini,
escapegeminiline-tgemini), either for
multiple lines or compressed to a single line.escapehtml,
escapehtmlattr,
escapehtmlurl-thtml) body content,
attributes, and URL attributes, respectively.escapelatex-tlatex) body content.escaperoff,
escaperoffline-tms,
-tman), either for multiple
lines or compressed to a single line. escaperoff
also escapes initial roff delimiters and those after newlines.joinlowercasesplittrim prior to the first split. The resulting list
has no items that are only white-space.trimuppercaseNO_COLOR-tterm mode. Synonym for
NO_COLOUR. Same as
--term-nocolour.--template is not
provided to -thtml.--template is not
provided to -tlatex.--template is not
provided to -tman.--template is not
provided to -tms.-tfodt documents. Template
for --odt-style styles.The lowdown-diff utility exits 0 on
success, and >0 if an error occurs.
To view Markdown differences on an ANSI-compatible, UTF-8 terminal:
lowdown-diff -tterm old.md new.md |
less -RThe terminal may also be used with groff(1) rendering:
lowdown-diff -stms old.md new.md | \ groff -itk -mspdf -Tutf8 | less -R lowdown-diff -stman old.md new.md | \ groff -itk -man -Tutf8 | less -R
To emit a standalone HTML5 document:
lowdown-diff -s old.md new.md >
foo.htmlTo use groff(1) to format as a PS file:
lowdown-diff -stms old.md new.md | \ groff -itk -mspdf > foo.ps
Or with LaTeX:
lowdown-diff -stlatex old.md new.md > foo.latex pslatex foo.latex
PDF generation follows similar logic:
lowdown-diff -stms old.md new.md | \ pdfroff -itk -mspdf > foo.pdf lowdown-diff -stlatex old.md new.md > foo.latex pdflatex foo.latex
UTF-8 support for groff(1) PDF or PS output requires appropriate fonts, such as the Unicode Times font. This and other Unicode fonts are not always installed by default. They may be found, for PDF output, in the devpdf set of the groff(1) font directory and are prefixed with ‘U’.
lowdown-diff -stms old.md new.md | \ pdfroff -itk -mspdf -FU-T > foo.pdf
lowdown-diff was written by
Kristaps Dzonsons,
kristaps@bsd.lv.
When viewing -tman
differences with mandoc(1), the marker colours are not
rendered. The -tgemini output
also currently has no way of encoding differences.
| November 30, 2025 | Debian |