diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-01-07 21:52:23 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-01-07 21:52:23 +0000 |
| commit | bf06f5dd16c0261c3388f5cad3dd93255a24a23b (patch) | |
| tree | 9a4dd03547e4c451340081918934d94a207f6f05 | |
| parent | dbf50a884567df772c54b4f1adbc24f0dbc87647 (diff) | |
Add API reference to README.md
| -rw-r--r-- | README.md | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -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: |
