parameters: (html_body, html_content)
return_statement: return html_body[:insert_index] + html_content + html_body[insert_index:]
docstring: Prepend some HTML content at the beginning of an other HTML content.
docstring_summary: Prepend some HTML content at the beginning of an other HTML content.
docstring_tokens: Prepend some HTML content at the beginning of an other HTML content .
function: def prepend_html_content(html_body, html_content):
      """Prepend some HTML content at the beginning of an other HTML content."""
      html_content = type(html_content)(re.sub(r'(?i)(</?(?:html|body|head|!\s*DOCTYPE)[^>]*>)', '', html_content))
      html_content = html_content.strip()
  
      body_match = re.search(r'<body[^>]*>', html_body) or re.search(r'<html[^>]*>', html_body)
      insert_index = body_match.end() if body_match else 0
  
      return html_body[:insert_index] + html_content + html_body[insert_index:]
function_tokens: def prepend_html_content ( html_body , html_content ) : html_content = type ( html_content ) ( re . sub ( r'(?i)(</?(?:html|body|head|!\s*DOCTYPE)[^>]*>)' , '' , html_content ) ) html_content = html_content . strip ( ) body_match = re . search ( r'<body[^>]*>' , html_body ) or re . search ( r'<html[^>]*>' , html_body ) insert_index = body_match . end ( ) if body_match else 0 return html_body [ : insert_index ] + html_content + html_body [ insert_index : ]