aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--markdown/extensions/html_tidy.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/markdown/extensions/html_tidy.py b/markdown/extensions/html_tidy.py
index 5105e33..e1736eb 100644
--- a/markdown/extensions/html_tidy.py
+++ b/markdown/extensions/html_tidy.py
@@ -29,7 +29,10 @@ Dependencies:
"""
import markdown
-import tidy
+try:
+ import tidy
+except ImportError:
+ tidy = None
class TidyExtension(markdown.Extension):
@@ -46,7 +49,8 @@ class TidyExtension(markdown.Extension):
# Save options to markdown instance
md.tidy_options = self.config
# Add TidyProcessor to postprocessors
- md.postprocessors['tidy'] = TidyProcessor(md)
+ if tidy:
+ md.postprocessors['tidy'] = TidyProcessor(md)
class TidyProcessor(markdown.postprocessors.Postprocessor):