diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-07-18 15:24:10 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-07-18 15:24:10 +0100 |
| commit | e0830e1ef003abb0fa07f3ef04d9e8c3c70b45f4 (patch) | |
| tree | 3a5994a9b97208fb85246f7f4067a9969d87269f /README.md | |
| parent | 93747f4c482a46b282dd332f088767a3a35c3278 (diff) | |
Document underline conversion in README.md
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -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: |
