summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-07-05 15:41:18 +0100
committerMichael Williamson <mike@zwobble.org>2014-07-05 15:41:18 +0100
commite7e9cd0c2ff72efd6533d992098f2998a9600893 (patch)
tree89f2077cdd02b345145fbc4bf64dec30215746b3
parent3fae69723ba916980f22a888f082a017e2fe4c8e (diff)
Describe API in README
-rw-r--r--README.md31
1 files changed, 31 insertions, 0 deletions
diff --git a/README.md b/README.md
index 921a095..aa192e9 100644
--- a/README.md
+++ b/README.md
@@ -99,6 +99,37 @@ pass `include_default_style_map=False`:
```python
result = mammoth.convert_to_html(docx_file, style_map=style_map, include_default_style_map=False)
```
+
+### API
+
+#### `mammoth.convert_to_html(fileobj, style_map=None, include_default_style_map=True)`
+
+Converts the source document to HTML.
+
+* `fileobj`: a file-like object containing the source document.
+ Files should be opened in binary mode.
+
+* `style_map`: a string to specify the mapping of Word styles to HTML.
+ See the section "Writing style maps" for a description of the syntax.
+
+* `include_default_style_map`: by default, the style map passed in `style_map` is combined with the default style map.
+ To stop using the default style map altogether,
+ pass `include_default_style_map=False`.
+
+* Returns a result with 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 style maps
A style map is made up of a number of style mappings separated by new lines.