From 4621194f4940223b0a49e5d089111e70cb712a46 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 17 Jun 2015 14:40:37 +0100 Subject: Document underline support in style maps --- README.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index bc6761f..a49656c 100644 --- a/README.md +++ b/README.md @@ -209,11 +209,24 @@ var options = { #### Underline By default, the underlining of any text is ignored since underlining can be confused with links in HTML documents. -This behaviour can be changed by setting the `convertUnderline` option to `mammoth.underline.element(name)`. - +This behaviour can be changed by adding a style mapping for `u`. For instance, suppose that a source document uses underlining for emphasis. The following will wrap any underlined source text in `` tags: +```javascript +var mammoth = require("mammoth"); + +var options = { + styleMap: [ + "u => em" + ] +}; +mammoth.convertToHtml({path: "path/to/document.docx"}, options); +``` + +The `convertUnderline` option is deprecated, and will be removed in Mammoth.js 1.0. +The following behaves as the example above: + ```javascript var options = { convertUnderline: mammoth.underline.element("em") @@ -462,6 +475,17 @@ For instance, to match a paragraph with the style ID `Heading1`: p.Heading1 ``` +#### Underline + +Match explicitly underlined text: + +``` +u +``` + +Note that this matches text that has had underline explicitly applied to it. +It will not match any text that is underlined because of its paragraph or run style. + ### HTML paths #### Single elements -- cgit v1.2.3