Add "autolinks" option

This option allows you to disable the creation of "autolink" style
links.
This commit is contained in:
Matthew Tretter
2013-07-31 21:58:48 -04:00
parent d707d107f6
commit f60d910335
2 changed files with 7 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ class MarkdownConverter(object):
class DefaultOptions:
strip = None
convert = None
autolinks = True
class Options(DefaultOptions):
pass
@@ -98,7 +99,7 @@ class MarkdownConverter(object):
def convert_a(self, el, text):
href = el.get('href')
title = el.get('title')
if text == href and not title:
if self.options['autolinks'] and text == href and not title:
# Shortcut syntax
return '<%s>' % href
title_part = ' "%s"' % title.replace('"', r'\"') if title else ''