diff options
| author | Michael Williamson <mike@michaelwilliamson.co.uk> | 2013-06-05 14:02:39 +0200 |
|---|---|---|
| committer | Michael Williamson <mike@michaelwilliamson.co.uk> | 2013-06-05 14:02:39 +0200 |
| commit | 72ad6b958b1d8ebc3ff2751118243b1e9f2b5e04 (patch) | |
| tree | 65903acb34fc3dfb10c4e20e3c0ea974ca33f7fd | |
| parent | 4fab9091dd90f655f1205e5d747cb4830b60573c (diff) | |
Update README.md
Fix usage example in README.md
| -rw-r--r-- | README.md | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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 |
