Skip to content

Commit 9539153

Browse files
committed
Removing unneccessary HTML elements from Gist output
1 parent 22b3df8 commit 9539153

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

includes/class-gistpress.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,9 @@ public function get_gist_html( $url, array $args ) {
420420
$this->debug_log( '<strong>' . __( 'Raw Key (Transient & Post Meta):', 'gistpress' ) . '</strong> ' . $raw_key, $shortcode_hash );
421421
$this->debug_log( '<strong>' . __( 'Processed Output Key (Transient):', 'gistpress' ) . '</strong> ' . $transient_key, $shortcode_hash );
422422

423+
// Strip unneccessary elements from HTML output
424+
$html = preg_replace('/^<!DOCTYPE.+?>/i', '', str_ireplace( array('<html>', '</html>', '<body>', '</body>'), '', $html));
425+
423426
return $html;
424427
}
425428

0 commit comments

Comments
 (0)