MCPcopy Create free account
hub / github.com/Python-Markdown/markdown / run

Method run

markdown/blockprocessors.py:567–585  ·  view source on GitHub ↗
(self, parent: etree.Element, blocks: list[str])

Source from the content-addressed store, hash-verified

565 return not block or block.startswith('\n')
566
567 def run(self, parent: etree.Element, blocks: list[str]) -> None:
568 block = blocks.pop(0)
569 filler = '\n\n'
570 if block:
571 # Starts with empty line
572 # Only replace a single line.
573 filler = '\n'
574 # Save the rest for later.
575 theRest = block[1:]
576 if theRest:
577 # Add remaining lines to master blocks for later.
578 blocks.insert(0, theRest)
579 sibling = self.lastChild(parent)
580 if (sibling is not None and sibling.tag == 'pre' and
581 len(sibling) and sibling[0].tag == 'code'):
582 # Last block is a code block. Append to preserve whitespace.
583 sibling[0].text = util.AtomicString(
584 '{}{}'.format(sibling[0].text, filler)
585 )
586
587
588class ReferenceProcessor(BlockProcessor):

Callers

nothing calls this directly

Calls 1

lastChildMethod · 0.80

Tested by

no test coverage detected