Installed file: __init__.py SHA256: 281bca0e2ab84a21825376f82d07d95455f41a6b0392bf95950bf29aac540b40 Official source: https://raw.githubusercontent.com/matthewwithanm/python-markdownify/1.2.3/markdownify/__init__.py Accessed: 2026-10-27 MarkdownConverter.convert_tr (installed line 747) def convert_tr(self, el, text, parent_tags): cells = el.find_all(['td', 'th']) is_first_row = el.find_previous_sibling() is None is_headrow = ( all([cell.name == 'th' for cell in cells]) or (el.parent.name == 'thead' # avoid multiple tr in thead and len(el.parent.find_all('tr')) == 1) ) is_head_row_missing = ( (is_first_row and not el.parent.name == 'tbody') or (is_first_row and el.parent.name == 'tbody' and len(el.parent.parent.find_all(['thead'])) < 1) ) overline = '' underline = '' full_colspan = 0 for cell in cells: if 'colspan' in cell.attrs and cell['colspan'].isdigit(): full_colspan += max(1, min(1000, int(cell['colspan']))) else: full_colspan += 1 if ((is_headrow or (is_head_row_missing and self.options['table_infer_header'])) and is_first_row): # first row and: # - is headline or # - headline is missing and header inference is enabled # print headline underline underline += '| ' + ' | '.join(['---'] * full_colspan) + ' |' + '\n' elif ((is_head_row_missing and not self.options['table_infer_header']) or (is_first_row and (el.parent.name == 'table' or (el.parent.name == 'tbody' and not el.parent.find_previous_sibling())))): # headline is missing and header inference is disabled or: # first row, not headline, and: # - the parent is table or # - the parent is tbody at the beginning of a table. # print empty headline above this row overline += '| ' + ' | '.join([''] * full_colspan) + ' |' + '\n' overline += '| ' + ' | '.join(['---'] * full_colspan) + ' |' + '\n' return overline + '|' + text + '\n' + underline MarkdownConverter.convert_pre (installed line 688) def convert_pre(self, el, text, parent_tags): if not text: return '' code_language = self.options['code_language'] if self.options['code_language_callback']: code_language = self.options['code_language_callback'](el) or code_language if self.options['strip_pre'] == STRIP: text = strip_pre(text) # remove all leading/trailing newlines elif self.options['strip_pre'] == STRIP_ONE: text = strip1_pre(text) # remove one leading/trailing newline elif self.options['strip_pre'] is None: pass # leave leading and trailing newlines as-is else: raise ValueError('Invalid value for strip_pre: %s' % self.options['strip_pre']) return '\n\n```%s\n%s\n```\n\n' % (code_language, text)