summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@michaelwilliamson.co.uk>2013-06-05 14:02:39 +0200
committerMichael Williamson <mike@michaelwilliamson.co.uk>2013-06-05 14:02:39 +0200
commit72ad6b958b1d8ebc3ff2751118243b1e9f2b5e04 (patch)
tree65903acb34fc3dfb10c4e20e3c0ea974ca33f7fd
parent4fab9091dd90f655f1205e5d747cb4830b60573c (diff)
Update README.md
Fix usage example in README.md
-rw-r--r--README.md12
1 files changed, 7 insertions, 5 deletions
diff --git a/README.md b/README.md
index da88e50..dbb05cb 100644
--- a/README.md
+++ b/README.md
@@ -24,9 +24,11 @@ To convert an existing .docx file to HTML, use `mammoth.convertToHtml`:
```javascript
var mammoth = require("mammoth");
-var result = mammoth.convertToHtml({path: "path/to/document.docx"});
-var html = result.value; // The generated HTML
-var messages = result.messages; // Any messages, such as warnings during conversion
+mammoth.convertToHtml({path: "path/to/document.docx"})
+ .then(function(result){
+ var html = result.value; // The generated HTML
+ var messages = result.messages; // Any messages, such as warnings during conversion
+ });
```
By default,
@@ -45,7 +47,7 @@ var options = {
style("p.Heading2 => h2")
]
};
-var result = mammoth.convertToHtml({path: "path/to/document.docx"}, options);
+mammoth.convertToHtml({path: "path/to/document.docx"}, options);
```
To extend the standard style map:
@@ -62,7 +64,7 @@ var customStyles = [
var options = {
styleMap: customStyles.concat(mammoth.standardOptions.styleMap)
};
-var result = mammoth.convertToHtml({path: "path/to/document.docx"}, options);
+mammoth.convertToHtml({path: "path/to/document.docx"}, options);
```
## Writing styles