diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-05-06 14:23:01 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-05-06 14:23:01 +0100 |
| commit | b82e1feea75ccf28b9cbdf7c08ba06e8733af16c (patch) | |
| tree | 2c7fefecb09e81a694f0bd0bf19ac4f7895b02ca | |
| parent | ec81c0664591621a611b1aedce6221b06e03da2c (diff) | |
Provide example of extending standard style map
| -rw-r--r-- | README.md | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -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: |
