From bf06f5dd16c0261c3388f5cad3dd93255a24a23b Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 7 Jan 2014 21:52:23 +0000 Subject: Add API reference to README.md --- README.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d2510ac..ff9e70f 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ You can start it up by running `node lib/web.js` from the project directory. Browserify can be used to run Mammoth in the browser. To see an example, run `make setup` and open `browser-demo/index.html` in a web browser. -### API +### Library To convert an existing .docx file to HTML, use `mammoth.convertToHtml`: @@ -77,6 +77,30 @@ var options = { mammoth.convertToHtml({path: "path/to/document.docx"}, options); ``` +### API + +#### `mammoth.convertToHtml(input, options)` + +Converts the source document to HTML. + +* `input` should be an object describing the source document. + To read the file found at `path`, pass in `{path: path}`. + +* Returns a promise containing a result. + This result has the following properties: + +** `value`: the generated HTML + +** `messages`: any messages, such as errors and warnings, generated during the conversion + +#### Messages + +Each message has the following properties: + +* `type`: a string representing the type of the message, such as `"warning"` + +* `message`: a string containing the actual message + ## Writing styles A style has two parts: -- cgit v1.2.3