aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/mammoth/DocumentConverter.java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-03-27 19:20:19 +0100
committerMichael Williamson <mike@zwobble.org>2017-03-27 19:20:19 +0100
commit244ed7482aedf44a8afccc7b2f7f77c977974f82 (patch)
tree9d19d3bf802de4dde5a03127a59b612e5df87f46 /src/main/java/org/zwobble/mammoth/DocumentConverter.java
parentb1388b638a872de859d13fc348a80f1d2e2fb634 (diff)
Add custom image converters
Diffstat (limited to 'src/main/java/org/zwobble/mammoth/DocumentConverter.java')
-rw-r--r--src/main/java/org/zwobble/mammoth/DocumentConverter.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/org/zwobble/mammoth/DocumentConverter.java b/src/main/java/org/zwobble/mammoth/DocumentConverter.java
index feba5ac..2dea8e8 100644
--- a/src/main/java/org/zwobble/mammoth/DocumentConverter.java
+++ b/src/main/java/org/zwobble/mammoth/DocumentConverter.java
@@ -1,5 +1,6 @@
package org.zwobble.mammoth;
+import org.zwobble.mammoth.images.ImageConverter;
import org.zwobble.mammoth.internal.InternalDocumentConverter;
import org.zwobble.mammoth.internal.conversion.DocumentToHtmlOptions;
@@ -60,6 +61,14 @@ public class DocumentConverter {
}
/**
+ * By default, images are converted to {@code <img>} elements with the source included inline in the {@code src} attribute.
+ * Call this to change how images are converted.
+ */
+ public DocumentConverter imageConverter(ImageConverter.ImgElement imageConverter) {
+ return new DocumentConverter(options.imageConverter(imageConverter));
+ }
+
+ /**
* Converts {@code stream} into an HTML string.
* Note that using this method instead of {@link #convertToHtml(File file)}
* means that relative paths to other files, such as images, cannot be resolved.