@@ -319,6 +319,38 @@ def convert_code(self, el, text, convert_as_inline):
319
319
320
320
convert_kbd = convert_code
321
321
322
+ def convert_dd (self , el , text , convert_as_inline ):
323
+ text = (text or '' ).strip ()
324
+ if convert_as_inline :
325
+ return ' ' + text + ' '
326
+ if not text :
327
+ return '\n '
328
+
329
+ # indent definition content lines by four spaces
330
+ def _indent_for_dd (match ):
331
+ line_content = match .group (1 )
332
+ return ' ' + line_content if line_content else ''
333
+ text = line_with_content_re .sub (_indent_for_dd , text )
334
+
335
+ # insert definition marker into first-line indent whitespace
336
+ text = ':' + text [1 :]
337
+
338
+ return '%s\n ' % text
339
+
340
+ def convert_dt (self , el , text , convert_as_inline ):
341
+ # remove newlines from term text
342
+ text = (text or '' ).strip ()
343
+ text = all_whitespace_re .sub (' ' , text )
344
+ if convert_as_inline :
345
+ return ' ' + text + ' '
346
+ if not text :
347
+ return '\n '
348
+
349
+ # TODO - format consecutive <dt> elements as directly adjacent lines):
350
+ # https://michelf.ca/projects/php-markdown/extra/#def-list
351
+
352
+ return '\n %s\n ' % text
353
+
322
354
def _convert_hn (self , n , el , text , convert_as_inline ):
323
355
""" Method name prefixed with _ to prevent <hn> to call this """
324
356
if convert_as_inline :
0 commit comments