aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-04-02 16:55:59 +0100
committerMichael Williamson <mike@zwobble.org>2016-04-02 16:58:51 +0100
commitbc86f042f5bdcec4bab45508eab3617d0b370741 (patch)
treec723a67f20ef3cdae52d8a0b5cc66d92ac6f1fbd /README.md
parent241f56dd56ccda41bcecf95fdc0e069c516ca760 (diff)
Rename images.inline to images.img_element
Diffstat (limited to 'README.md')
-rw-r--r--README.md14
1 files changed, 8 insertions, 6 deletions
diff --git a/README.md b/README.md
index c423581..1a4e1a6 100644
--- a/README.md
+++ b/README.md
@@ -177,7 +177,7 @@ def convert_image(image):
"src": "data:{0};base64,{1}".format(image.content_type, encoded_src)
}
-mammoth.convert_to_html(docx_file, convert_image=mammoth.images.inline(convert_image))
+mammoth.convert_to_html(docx_file, convert_image=mammoth.images.img_element(convert_image))
```
#### Bold
@@ -312,8 +312,8 @@ Each message has the following properties:
#### Image converters
-An inline image converter can be created by calling `mammoth.images.inline(func)`.
-This creates an inline `<img>` element for each image in the original docx.
+An image converter can be created by calling `mammoth.images.img_element(func)`.
+This creates an `<img>` element for each image in the original docx.
`func` should be a function that has one argument `image`.
This argument is the image element being converted,
and has the following properties:
@@ -322,8 +322,10 @@ and has the following properties:
* `content_type`: the content type of the image, such as `image/png`.
-`func` should return a `dict` with a `src` item,
-which will be used as the `src` attribute on the `<img>` element.
+`func` should return a `dict` of attributes for the `<img>` element.
+At a minimum, this should include the `src` attribute.
+If any alt text is found for the image,
+this will be automatically added to the element's attributes.
For instance, the following replicates the default image conversion:
@@ -336,7 +338,7 @@ def convert_image(image):
"src": "data:{0};base64,{1}".format(image.content_type, encoded_src)
}
-mammoth.images.inline(convert_image)
+mammoth.images.img_element(convert_image)
```
## Writing style maps