original_string: public function convert($html) {
      if (preg_match('/^\s*$/u', $html)) {
        return '';
      }
      $html = '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"></head>' . $html . '</body></html>';
      $this->dom = new \DOMDocument();
      if (!$this->dom->loadHTML($html)) {
        return NULL;
      }
      $xp = new \DOMXPath($this->dom);
      return implode(self::BLOCK_DELIMITER, $this->getBlocks(
        $xp->query('/html/body')->item(0)->childNodes
      ));
    }
code: public function convert($html) {
      if (preg_match('/^\s*$/u', $html)) {
        return '';
      }
      $html = '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"></head>' . $html . '</body></html>';
      $this->dom = new \DOMDocument();
      if (!$this->dom->loadHTML($html)) {
        return NULL;
      }
      $xp = new \DOMXPath($this->dom);
      return implode(self::BLOCK_DELIMITER, $this->getBlocks(
        $xp->query('/html/body')->item(0)->childNodes
      ));
    }
code_tokens: public function convert ( $ html ) { if ( preg_match ( '/^\s*$/u' , $ html ) ) { return '' ; } $ html = '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"></head>' . $ html . '</body></html>' ; $ this -> dom = new \ DOMDocument ( ) ; if ( ! $ this -> dom -> loadHTML ( $ html ) ) { return NULL ; } $ xp = new \ DOMXPath ( $ this -> dom ) ; return implode ( self :: BLOCK_DELIMITER , $ this -> getBlocks ( $ xp -> query ( '/html/body' ) -> item ( 0 ) -> childNodes ) ) ; }
docstring: Convert HTML to Apple News Markdown.
  
  @param string $html
  HTML to convert. Value is not validated, it is caller's responsibility
  to validate.
  
  @return string|NULL
  Markdown representation of the HTML, or NULL if failed.
docstring_tokens: Convert HTML to Apple News Markdown .