Add discussion of custom styles to MANUAL.txt.

This commit is contained in:
Jesse Rosenthal 2016-08-15 14:22:55 -04:00
parent b784ce8866
commit b512573805

View file

@ -3827,6 +3827,54 @@ To disable highlighting, use the `--no-highlight` option.
[highlighting-kate]: https://github.com/jgm/highlighting-kate
Custom Styles in Docx Output
============================
By default, pandoc's docx output applies a predefined set of styles for
blocks such as paragraphs and block quotes, and uses largely default
formatting (italics, bold) for inlines. This will work for most
purposes, especially alongside a `reference.docx` file. However, if you
need to apply your own styles to blocks, or match a preexisting set of
styles, pandoc allows you to define custom styles for blocks and text
using `div`s and `span`s, respecitively.
If you define a `div` or `span` with the attribute `custom-style`,
pandoc will apply your specified style to the contained elements. So,
for example,
<span custom-style="Emphatically">Get out,</span> he said.
would produce a docx file with "Get out," styled with character
style `Emphatically`. Similarly,
Dickinson starts the poem simply:
<div custom-style="Poetry">
| A Bird came down the Walk---
| He did not know I saw---
</div>
Would style the two contained lines with the `Poetry` paragraph style.
If the styles are not yet in your reference.docx, they will be defined
in the output file as inheriting from normal text. If they are already
defined, pandoc will not alter the definition.
This feature allows for greatest customization in conjunction with
[pandoc filters]. If you want all paragraphs after block quotes to be
indented, you can write a filter to apply the styles necessary. If you
want all italics to be transformed to the `Emphasis` character style
(perhaps to change their color), you can write a filter which will
transform all italicized inlines
Emph <inlines>
to
Span ("", [], [("custom-style", "Emphasis")] <inlines>
[pandoc filters]: http://pandoc.org/scripting.html
Custom writers
==============