Add shortcut link syntax

This commit is contained in:
Matthew Tretter
2013-07-31 19:22:41 -04:00
parent 934c97b342
commit 1ef4dd1468
2 changed files with 8 additions and 0 deletions

View File

@@ -82,6 +82,9 @@ class MarkdownConverter(object):
def convert_a(self, el, text):
href = el.get('href')
title = el.get('title')
if text == href and not title:
# Shortcut syntax
return '<%s>' % href
title_part = ' "%s"' % title.replace('"', r'\"') if title else ''
return '[%s](%s%s)' % (text or '', href, title_part) if href else text or ''