@@ -66,13 +66,16 @@ def _todict(obj):
6666
6767class MarkdownConverter (object ):
6868 class DefaultOptions :
69- strip = None
70- convert = None
7169 autolinks = True
72- heading_style = UNDERLINED
7370 bullets = '*+-' # An iterable of bullet types.
74- strong_em_symbol = ASTERISK
71+ convert = None
72+ default_title = False
73+ heading_style = UNDERLINED
7574 newline_style = SPACES
75+ strip = None
76+ strong_em_symbol = ASTERISK
77+ sub_symbol = ''
78+ sup_symbol = ''
7679
7780 class Options (DefaultOptions ):
7881 pass
@@ -198,9 +201,14 @@ def convert_a(self, el, text, convert_as_inline):
198201 href = el .get ('href' )
199202 title = el .get ('title' )
200203 # For the replacement see #29: text nodes underscores are escaped
201- if self .options ['autolinks' ] and text .replace (r'\_' , '_' ) == href and not title :
204+ if (self .options ['autolinks' ]
205+ and text .replace (r'\_' , '_' ) == href
206+ and not title
207+ and not self .options ['default_title' ]):
202208 # Shortcut syntax
203209 return '<%s>' % href
210+ if self .options ['default_title' ] and not title :
211+ title = href
204212 title_part = ' "%s"' % title .replace ('"' , r'\"' ) if title else ''
205213 return '%s[%s](%s%s)%s' % (prefix , text , href , title_part , suffix ) if href else text
206214
@@ -319,6 +327,10 @@ def convert_pre(self, el, text, convert_as_inline):
319327
320328 convert_samp = convert_code
321329
330+ convert_sub = abstract_inline_conversion (lambda self : self .options ['sub_symbol' ])
331+
332+ convert_sup = abstract_inline_conversion (lambda self : self .options ['sup_symbol' ])
333+
322334 def convert_table (self , el , text , convert_as_inline ):
323335 return '\n \n ' + text + '\n '
324336
0 commit comments