markdownify 1.0.0__tar.gz → 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {markdownify-1.0.0 → markdownify-1.1.0}/PKG-INFO +1 -1
- {markdownify-1.0.0 → markdownify-1.1.0}/markdownify/__init__.py +34 -10
- {markdownify-1.0.0 → markdownify-1.1.0}/markdownify.egg-info/PKG-INFO +1 -1
- {markdownify-1.0.0 → markdownify-1.1.0}/pyproject.toml +1 -1
- {markdownify-1.0.0 → markdownify-1.1.0}/.github/workflows/python-app.yml +0 -0
- {markdownify-1.0.0 → markdownify-1.1.0}/.github/workflows/python-publish.yml +0 -0
- {markdownify-1.0.0 → markdownify-1.1.0}/.gitignore +0 -0
- {markdownify-1.0.0 → markdownify-1.1.0}/LICENSE +0 -0
- {markdownify-1.0.0 → markdownify-1.1.0}/MANIFEST.in +0 -0
- {markdownify-1.0.0 → markdownify-1.1.0}/README.rst +0 -0
- {markdownify-1.0.0 → markdownify-1.1.0}/markdownify/main.py +0 -0
- {markdownify-1.0.0 → markdownify-1.1.0}/markdownify.egg-info/SOURCES.txt +0 -0
- {markdownify-1.0.0 → markdownify-1.1.0}/markdownify.egg-info/dependency_links.txt +0 -0
- {markdownify-1.0.0 → markdownify-1.1.0}/markdownify.egg-info/entry_points.txt +0 -0
- {markdownify-1.0.0 → markdownify-1.1.0}/markdownify.egg-info/not-zip-safe +0 -0
- {markdownify-1.0.0 → markdownify-1.1.0}/markdownify.egg-info/requires.txt +0 -0
- {markdownify-1.0.0 → markdownify-1.1.0}/markdownify.egg-info/top_level.txt +0 -0
- {markdownify-1.0.0 → markdownify-1.1.0}/setup.cfg +0 -0
- {markdownify-1.0.0 → markdownify-1.1.0}/shell.nix +0 -0
- {markdownify-1.0.0 → markdownify-1.1.0}/tox.ini +0 -0
|
@@ -106,6 +106,7 @@ def should_remove_whitespace_inside(el):
|
|
|
106
106
|
return el.name in ('p', 'blockquote',
|
|
107
107
|
'article', 'div', 'section',
|
|
108
108
|
'ol', 'ul', 'li',
|
|
109
|
+
'dl', 'dt', 'dd',
|
|
109
110
|
'table', 'thead', 'tbody', 'tfoot',
|
|
110
111
|
'tr', 'td', 'th')
|
|
111
112
|
|
|
@@ -442,7 +443,7 @@ class MarkdownConverter(object):
|
|
|
442
443
|
|
|
443
444
|
def convert_br(self, el, text, parent_tags):
|
|
444
445
|
if '_inline' in parent_tags:
|
|
445
|
-
return
|
|
446
|
+
return ' '
|
|
446
447
|
|
|
447
448
|
if self.options['newline_style'].lower() == BACKSLASH:
|
|
448
449
|
return '\\\n'
|
|
@@ -489,6 +490,11 @@ class MarkdownConverter(object):
|
|
|
489
490
|
|
|
490
491
|
return '%s\n' % text
|
|
491
492
|
|
|
493
|
+
# definition lists are formatted as follows:
|
|
494
|
+
# https://pandoc.org/MANUAL.html#definition-lists
|
|
495
|
+
# https://michelf.ca/projects/php-markdown/extra/#def-list
|
|
496
|
+
convert_dl = convert_div
|
|
497
|
+
|
|
492
498
|
def convert_dt(self, el, text, parent_tags):
|
|
493
499
|
# remove newlines from term text
|
|
494
500
|
text = (text or '').strip()
|
|
@@ -501,7 +507,7 @@ class MarkdownConverter(object):
|
|
|
501
507
|
# TODO - format consecutive <dt> elements as directly adjacent lines):
|
|
502
508
|
# https://michelf.ca/projects/php-markdown/extra/#def-list
|
|
503
509
|
|
|
504
|
-
return '\n%s\n' % text
|
|
510
|
+
return '\n\n%s\n' % text
|
|
505
511
|
|
|
506
512
|
def _convert_hn(self, n, el, text, parent_tags):
|
|
507
513
|
""" Method name prefixed with _ to prevent <hn> to call this """
|
|
@@ -538,6 +544,24 @@ class MarkdownConverter(object):
|
|
|
538
544
|
|
|
539
545
|
return '' % (alt, src, title_part)
|
|
540
546
|
|
|
547
|
+
def convert_video(self, el, text, parent_tags):
|
|
548
|
+
if ('_inline' in parent_tags
|
|
549
|
+
and el.parent.name not in self.options['keep_inline_images_in']):
|
|
550
|
+
return text
|
|
551
|
+
src = el.attrs.get('src', None) or ''
|
|
552
|
+
if not src:
|
|
553
|
+
sources = el.find_all('source', attrs={'src': True})
|
|
554
|
+
if sources:
|
|
555
|
+
src = sources[0].attrs.get('src', None) or ''
|
|
556
|
+
poster = el.attrs.get('poster', None) or ''
|
|
557
|
+
if src and poster:
|
|
558
|
+
return '[](%s)' % (text, poster, src)
|
|
559
|
+
if src:
|
|
560
|
+
return '[%s](%s)' % (text, src)
|
|
561
|
+
if poster:
|
|
562
|
+
return '' % (text, poster)
|
|
563
|
+
return text
|
|
564
|
+
|
|
541
565
|
def convert_list(self, el, text, parent_tags):
|
|
542
566
|
|
|
543
567
|
# Converting a list to inline is undefined.
|
|
@@ -677,6 +701,12 @@ class MarkdownConverter(object):
|
|
|
677
701
|
)
|
|
678
702
|
overline = ''
|
|
679
703
|
underline = ''
|
|
704
|
+
full_colspan = 0
|
|
705
|
+
for cell in cells:
|
|
706
|
+
if 'colspan' in cell.attrs and cell['colspan'].isdigit():
|
|
707
|
+
full_colspan += int(cell["colspan"])
|
|
708
|
+
else:
|
|
709
|
+
full_colspan += 1
|
|
680
710
|
if ((is_headrow
|
|
681
711
|
or (is_head_row_missing
|
|
682
712
|
and self.options['table_infer_header']))
|
|
@@ -685,12 +715,6 @@ class MarkdownConverter(object):
|
|
|
685
715
|
# - is headline or
|
|
686
716
|
# - headline is missing and header inference is enabled
|
|
687
717
|
# print headline underline
|
|
688
|
-
full_colspan = 0
|
|
689
|
-
for cell in cells:
|
|
690
|
-
if 'colspan' in cell.attrs and cell['colspan'].isdigit():
|
|
691
|
-
full_colspan += int(cell["colspan"])
|
|
692
|
-
else:
|
|
693
|
-
full_colspan += 1
|
|
694
718
|
underline += '| ' + ' | '.join(['---'] * full_colspan) + ' |' + '\n'
|
|
695
719
|
elif ((is_head_row_missing
|
|
696
720
|
and not self.options['table_infer_header'])
|
|
@@ -703,8 +727,8 @@ class MarkdownConverter(object):
|
|
|
703
727
|
# - the parent is table or
|
|
704
728
|
# - the parent is tbody at the beginning of a table.
|
|
705
729
|
# print empty headline above this row
|
|
706
|
-
overline += '| ' + ' | '.join([''] *
|
|
707
|
-
overline += '| ' + ' | '.join(['---'] *
|
|
730
|
+
overline += '| ' + ' | '.join([''] * full_colspan) + ' |' + '\n'
|
|
731
|
+
overline += '| ' + ' | '.join(['---'] * full_colspan) + ' |' + '\n'
|
|
708
732
|
return overline + '|' + text + '\n' + underline
|
|
709
733
|
|
|
710
734
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|