From 4510e66c6426c88868f74a948123eb48a302d487 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 7 Jan 2014 22:32:52 +0000 Subject: Allow default style map to be disabled --- README.md | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 135c7bf..d353e26 100644 --- a/README.md +++ b/README.md @@ -67,32 +67,19 @@ var options = { mammoth.convertToHtml({path: "path/to/document.docx"}, options); ``` -To more easily support style mappings stored in text files, -`styleMap` can also be a string. -Each non-blank line is treated as a separate style mapping: +User-defined style mappings are used in preference to the default style mappings. +To stop using the default style mappings altogether, +set `options.includeDefaultStyleMap` to `false`: ```javascript var options = { - styleMap: "p.SectionTitle => h1:fresh\n" + - "p.SubSectionTitle => h2:fresh" -}; -``` - -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.styleMap) + styleMap: [ + style("p.SectionTitle => h1:fresh"), + style("p.SubSectionTitle => h2:fresh") + ], + includeDefaultStyleMap: false + }; -mammoth.convertToHtml({path: "path/to/document.docx"}, options); ``` ### API -- cgit v1.2.3