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 arguments are as follows:
-s
-t
gemini,
-t
html,
-t
latex,
-t
ms,
-t
man, and
-t
fodt.-M
metadata-m
and what's parsed from the document.-m
metadata-M
, but is 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 modes. The
-T
mode form is retained for
backward compatibility.The following are options for input parsing. These affect the parse tree passed to all outputs.
--parse-hilite
--parse-math
--parse-maxdepth=depth
--parse-no-autolink
http
, https
,
ftp
, mailto
, and relative
links or link fragments.--parse-no-cmark
--parse-no-codeindent
--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-metadata
-m
or -M
.--parse-no-strike
--parse-no-super
--parse-no-tables
--parse-no-tasklists
There are many output options. The following are shared by all output modes:
--out-standalone
-s
.--out-no-smarty
What follows are per-output options. For HTML with
-t
html, these are as
follows:
--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-ids
id
attributes for headers.--html-no-num-ent
--html-no-owasp
--html-no-skiphtml
--html-no-escapehtml
.For both -t
man and
-t
ms, the following apply:
--nroff-no-groff
-t
ms mode and
-m
spdf passed to
groff(1)), or Unicode sequence syntax. The output is
compatible with traditional troff(1). Applies to
-t
man and
-t
ms.--nroff-no-numbered
-t
ms.--nroff-no-skiphtml
--nroff-nolinks
--nroff-shortlinks
for images and links. Applies
to -t
man or when
-nroff-no-groff
is specified.--nroff-shortlinks
-t
man
or when -nroff-no-groff
is specified.The -t
term output
has the following:
--term-columns=columns
--term-hmargin=margin
--term-no-ansi
--term-no-colour
.--term-no-colour
--term-nolinks
--term-shortlinks
for images and links.--term-shortlinks
--term-vmargin=margin
--term-width=width
The -t
gemini 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-metadata
The -t
latex output
has the following options:
--latex-no-numbered
--latex-no-skiphtml
The -t
fodt 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 -t
html.
-t
fodt-t
gemini-t
html<ins>
and
<del>
elements.-t
latexamsmath
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. Differences are rendered by
colouring in blue (insert) and red (delete) (this format is not
fixed).-t
man-t
ms-t
term-t
treeWhen -s
is specified, additional content
may be added to output:
-t
fodt<office:document>
and prologue
<office:automatic-styles>
,
<office:master-styles>
, and
<office:body>
.-t
html<html>
and prologue
<head>
.-t
latexdocumentclass
and
usepackage
statements, and surrounding
begin{document}
statements.-t
man,
-t
msIf parsed from the document or as given by
-m
or -M
, the following
metadata keys are used by additional content. The metadata keys are
canonicalised in lowercase and without spaces.
Metadata values should not be encoded in their output format, e.g., “css: foo&bar”. The renderer will perform any necessary output encoding.
affiliation
-t
html,
-t
latex, and
-t
ms.rcsauthor
.
Used in -t
fodt,
-t
html,
-t
latex, and
-t
ms.baseheaderlevel
shiftheadinglevelby
.copyright
-t
ms and
-t
html.css
-t
html.date
rcsdate
. Used in
-t
fodt,
-t
html,
-t
latex,
-t
man, and
-t
ms.javascript
-t
html.author
, but in RCS author format. Overrides
author
.rcsdate
date
, but in RCS date format. Overrides
date
.section
-t
man.shiftheadinglevelby
baseheaderlevel
. If unset or not a valid number,
defaults to zero. Used in
-t
fodt,
-t
html,
-t
latex,
-t
man, and
-t
ms.source
-t
man.volume
-t
man.title
-t
fodt,
-t
html,
-t
latex,
-t
man, and
-t
ms.Metadata values are parsed and may be used as variables in
markdown documents regardless of whether -s
is
specified or not.
Default values, such “Untitled article” for the
title
, are not set as metadata values, and will not
appear if the metadata key is used as a variable.
Differences in additional content metadata are rendered differently than in the document body: deleted metadata key-value pairs are not processed in the output, so only inserted or retained metadata are processed.
In formats where metadata are part of the document body, such as
-t
term and
-t
tree, all metadata are shown
as if in the document body.
NO_COLOR
-t
term mode. Synonym for
NO_COLOUR
. Same as
--term-nocolour
.-t
fodt 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 -R
The 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.html
To 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 -t
man
differences with mandoc, the marker colours are not rendered. The
-t
gemini output also currently
has no way of encoding differences.
June 19, 2024 | Debian |