From b82e1feea75ccf28b9cbdf7c08ba06e8733af16c Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 6 May 2013 14:23:01 +0100 Subject: Provide example of extending standard style map --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b921381..71991e7 100644 --- a/README.md +++ b/README.md @@ -42,12 +42,29 @@ var style = mammoth.style; var options = { styleMap: [ style("p.Heading1 => h1"), - style("p.Heading2 => h2"), + style("p.Heading2 => h2") ] }; var result = mammoth.convertToHtml({path: "path/to/document.docx"}, options); ``` +To extend the standard style map: + +```javascript +var mammoth = require("mammoth"); +var style = mammoth.style; + +var customStyles = [ + style("p.AsideHeading => div.aside > h2:fresh"), + style("p.AsideText => div.aside > p:fresh") +]; + +var options = { + styleMap: customStyles.concat(mammoth.standardOptions) +}; +var result = mammoth.convertToHtml({path: "path/to/document.docx"}, options); +``` + ## Writing styles A style has two parts: -- cgit v1.2.3