code: def merge_lines(blocks, page_blocks: List[Page]):
      text_blocks = []
      prev_type = None
      prev_line = None
      block_text = ""
      block_type = ""
      common_line_heights = [
          p.get_line_height_stats() for p in page_blocks
      ]
      for page in blocks:
          for block in page:
              block_type = block.most_common_block_type()
              if block_type != prev_type and prev_type:
                  text_blocks.append(
                      FullyMergedBlock(
                          text=block_surround(block_text, prev_type),
                          block_type=prev_type,
                      )
                  )
                  block_text = ""
  
              prev_type = block_type
              # Join lines in the block together properly
              for i, line in enumerate(block.lines):
                  line_height = line.bbox[3] - line.bbox[1]
                  prev_line_height = (
                      prev_line.bbox[3] - prev_line.bbox[1]
                      if prev_line
                      else 0
                  )
                  prev_line_x = prev_line.bbox[0] if prev_line else 0
                  prev_line = line
                  is_continuation = (
                      line_height == prev_line_height
                      and line.bbox[0] == prev_line_x
                  )
                  if block_text:
                      block_text = line_separator(
                          block_text,
                          line.text,
                          block_type,
                          is_continuation,
                      )
                  else:
                      block_text = line.text
  
      # Append the final block
      text_blocks.append(
          FullyMergedBlock(
              text=block_surround(block_text, prev_type),
              block_type=block_type,
          )
      )
      return text_blocks
  
file_path: pdf-to-markdown/marker/markdown.py
imports: from marker.schema import MergedLine, MergedBlock, FullyMergedBlock, Page
  import re
  from typing import List
label_desc: Use image node_id 6 for calling a global function with example usage: merge_lines(blocks, page_blocks) and returns: text_blocks