summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-05-06 14:23:01 +0100
committerMichael Williamson <mike@zwobble.org>2013-05-06 14:23:01 +0100
commitb82e1feea75ccf28b9cbdf7c08ba06e8733af16c (patch)
tree2c7fefecb09e81a694f0bd0bf19ac4f7895b02ca
parentec81c0664591621a611b1aedce6221b06e03da2c (diff)
Provide example of extending standard style map
-rw-r--r--README.md19
1 files changed, 18 insertions, 1 deletions
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: