aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-07-06 18:01:40 +0100
committerMichael Williamson <mike@zwobble.org>2014-07-06 18:01:40 +0100
commit8badf20e2107982f076ef9e90dc84820e96a77ff (patch)
treef98114adf03445d72c94673a70093c0d20f2c1c7
parent040607b07c6ea0d4788f1536d01a0de36039cc88 (diff)
Document extractRawText
-rw-r--r--README.md32
1 files changed, 32 insertions, 0 deletions
diff --git a/README.md b/README.md
index 0dfe9c6..b6b6054 100644
--- a/README.md
+++ b/README.md
@@ -109,6 +109,19 @@ mammoth.convertToHtml({path: "path/to/document.docx"})
Note that `mammoth.convertToHtml` returns a [promise](http://promises-aplus.github.io/promises-spec/).
+You can also extract the raw text of the document by using `mammoth.extractRawText`.
+This will ignore all formatting in the document.
+Each paragraph is followed by two newlines.
+
+```javascript
+mammoth.extractRawText({path: "path/to/document.docx"})
+ .then(function(result){
+ var text = result.value; // The raw text
+ var messages = result.messages;
+ })
+ .done();
+```
+
#### Custom style map
By default,
@@ -223,6 +236,25 @@ Converts the source document to HTML.
* `messages`: any messages, such as errors and warnings, generated during the conversion
+#### `mammoth.extractRawText(input)`
+
+Extract the raw text of the document.
+This will ignore all formatting in the document.
+Each paragraph is followed by two newlines.
+
+* `input`: an object describing the source document.
+ While running on node.js,
+ to read the file found at `path`, pass in `{path: path}`.
+ While running in the browser,
+ to read the file stored in an array buffer, pass in `{arrayBuffer: arrayBuffer}`.
+
+* Returns a promise containing a result.
+ This result has the following properties:
+
+ * `value`: the raw text
+
+ * `messages`: any messages
+
#### Messages
Each message has the following properties: