aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-07-18 15:24:10 +0100
committerMichael Williamson <mike@zwobble.org>2014-07-18 15:24:10 +0100
commite0830e1ef003abb0fa07f3ef04d9e8c3c70b45f4 (patch)
tree3a5994a9b97208fb85246f7f4067a9969d87269f
parent93747f4c482a46b282dd332f088767a3a35c3278 (diff)
Document underline conversion in README.md
-rw-r--r--README.md18
1 files changed, 16 insertions, 2 deletions
diff --git a/README.md b/README.md
index 83be637..ccbe976 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ The following features are currently supported:
* Images.
-* Bold and italics.
+* Bold, italics and underlines.
* Links.
@@ -139,7 +139,6 @@ This behaviour can be changed by setting the `convert_image` argument to an [ima
For instance, the following would replicate the default behaviour:
```python
-
def convert_image(image):
with image.open() as image_bytes:
encoded_src = base64.b64encode(image_bytes.read()).decode("ascii")
@@ -151,6 +150,18 @@ def convert_image(image):
mammoth.convert_to_html(docx_file, convert_image=mammoth.images.inline(convert_image))
```
+#### Underline
+
+By default, the underlining of any text is ignored since underlining can be confused with links in HTML documents.
+This behaviour can be changed by setting the `convert_underline` argument to `mammoth.underline.element(name)`.
+
+For instance, suppose that a source document uses underlining for emphasis.
+The following will wrap any underlined source text in `<em>` tags:
+
+```python
+mammoth.convert_to_html(docx_file, convert_underline=mammoth.underline.element("em"))
+```
+
### API
#### `mammoth.convert_to_html(fileobj, style_map=None, include_default_style_map=True)`
@@ -169,6 +180,9 @@ Converts the source document to HTML.
* `convert_image`: by default, images are converted to `<img>` elements with the source included inline in the `src` attribute.
Set this argument to an [image converter](#image-converters) to override the default behaviour.
+
+* `convert_underline`: by default, the underlining of any text is ignored.
+ Set this argument to [`mammoth.underline.element(name)`](#underline) to override the default behaviour.
* Returns a result with the following properties: