pandoc/test/command/3752.md
John MacFarlane 7a9832166e Add text wrapping to HTML output.
Previously the HTML writer was exceptional in not being
sensitive to the `--wrap` option.  With this change `--wrap`
now works for HTML. The default (as with other formats) is
automatic wrapping to 72 columns.

A new internal module, T.P.Writers.Blaze, exports `layoutMarkup`.
This converts a blaze Html structure into a doclayout Doc Text.

In addition, we now add a line break between an `img` tag
and the associated `figcaption`.

Note: Output is never wrapped in `writeHtmlStringForEPUB`.
This accords with previous behavior since previously the HTML
writer was insensitive to `--wrap` settings.  There's no real
need to wrap HTML inside a zipped container.

Note that the contents of script, textarea, and pre tags are
always laid out with the `flush` combinator, so that unwanted
spaces won't be introduced if these occur in an indented context
in a template.

Closes #7764.
2021-12-22 09:45:02 -08:00

2.1 KiB

% pandoc command/chap1/text.md command/chap2/text.md -f markdown+rebase_relative_paths --verbose -t docx -o - | pandoc -f docx -t plain
^D
[INFO] Loaded command/chap1/spider.png from command/chap1/spider.png
[INFO] Loaded command/chap2/spider.png from command/chap2/spider.png
[INFO] Loaded command/chap1/../../lalune.jpg from command/chap1/../../lalune.jpg
Chapter one

A spider: [spider]

Another spider: [another spider]

The moon: [moon]

Link to spider picture.

URL left alone: manual.

Absolute path left alone: absolute.

Link to fragment: chapter two.

Empty path: empty.

Chapter two

A spider: [spider]
% pandoc command/chap1/text.md command/chap2/text.md -f markdown+rebase_relative_paths -t html
^D
<h1 id="chapter-one">Chapter one</h1>
<p>A spider: <img src="command/chap1/spider.png" alt="spider" /></p>
<p>Another spider: <img src="command/chap2/spider.png" alt="another
spider" /></p>
<p>The moon: <img src="command/chap1/../../lalune.jpg" alt="moon" /></p>
<p>Link to <a href="command/chap1/spider.png">spider picture</a>.</p>
<p>URL left alone: <a
href="https://pandoc.org/MANUAL.html">manual</a>.</p>
<p>Absolute path left alone: <a
href="/foo/bar/baz.png">absolute</a>.</p>
<p>Link to fragment: <a href="#chapter-two">chapter two</a>.</p>
<p>Empty path: <a href="">empty</a>.</p>
<h1 id="chapter-two">Chapter two</h1>
<p>A spider: <img src="command/chap2/spider.png" alt="spider" /></p>
% pandoc command/chap1/text.md command/chap2/text.md -f commonmark+rebase_relative_paths -t html
^D
<h1>Chapter one</h1>
<p>A spider: <img src="command/chap1/spider.png" alt="spider" /></p>
<p>Another spider: <img src="command/chap2/spider.png" alt="another
spider" /></p>
<p>The moon: <img src="command/chap1/../../lalune.jpg" alt="moon" /></p>
<p>Link to <a href="command/chap1/spider.png">spider picture</a>.</p>
<p>URL left alone: <a
href="https://pandoc.org/MANUAL.html">manual</a>.</p>
<p>Absolute path left alone: <a
href="/foo/bar/baz.png">absolute</a>.</p>
<p>Link to fragment: <a href="#chapter-two">chapter two</a>.</p>
<p>Empty path: <a href="">empty</a>.</p>
<h1>Chapter two</h1>
<p>A spider: <img src="command/chap2/spider.png" alt="spider" /></p>