diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-01-07 22:32:52 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-01-07 22:32:52 +0000 |
| commit | 4510e66c6426c88868f74a948123eb48a302d487 (patch) | |
| tree | 48bbc31862b581e594351e7acb0793dafc42e506 /README.md | |
| parent | bfc33eec2b0a22e4bb0ee2412ec22df636134330 (diff) | |
Allow default style map to be disabled
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 31 |
1 files changed, 9 insertions, 22 deletions
@@ -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 |
