diff options
Diffstat (limited to 'lib/index.js')
| -rw-r--r-- | lib/index.js | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/index.js b/lib/index.js index 74f42d0..a7afed7 100644 --- a/lib/index.js +++ b/lib/index.js @@ -10,6 +10,8 @@ exports.extractRawText = extractRawText; exports.images = require("./images"); exports.transforms = require("./transforms"); exports.underline = require("./underline"); +var docxStyleMap = require("./docx/style-map"); +exports.writeStyleMapToDocx = docxStyleMap.writeStyleMap; function convertToHtml(input, options) { return convert(input, options); @@ -22,14 +24,22 @@ function convertToMarkdown(input, options) { } function convert(input, options) { - var fullOptions = readOptions(options); - - return docxReader.read(input) - .then(function(documentResult) { - return documentResult.map(fullOptions.transformDocument); + options = options || {}; + return docxStyleMap.readStyleMap(input) + .then(function(styleMap) { + if (!options.styleMap && styleMap) { + options.styleMap = styleMap; + } }) - .then(function(documentResult) { - return convertDocumentToHtml(documentResult, fullOptions); + .then(function() { + var fullOptions = readOptions(options); + return docxReader.read(input) + .then(function(documentResult) { + return documentResult.map(fullOptions.transformDocument); + }) + .then(function(documentResult) { + return convertDocumentToHtml(documentResult, fullOptions); + }); }); } |
