'tokenforge_changelog', '_wpnonce' => wp_create_nonce( 'tokenforge_changelog' ), 'TB_iframe' => 'true', 'width' => 772, 'height' => 700, ), admin_url( 'admin-ajax.php' ) ); $links[] = '' . esc_html__( 'Changelog', 'tokenforge' ) . ''; return $links; } /** * Markdown (the small subset CHANGELOG.md uses) to safe HTML. * * @param string $md Markdown. * @return string */ public static function to_html( $md ) { $html = ''; $list = false; $para = array(); $flush = function () use ( &$html, &$para ) { if ( $para ) { $html .= '
' . implode( ' ', $para ) . "
\n"; $para = array(); } }; $inline = function ( $t ) { $t = esc_html( $t ); $t = preg_replace( '/`([^`]+)`/', '$1', $t );
return preg_replace( '/\*\*([^*]+)\*\*/', '$1', $t );
};
foreach ( preg_split( '/\r?\n/', (string) $md ) as $line ) {
if ( preg_match( '/^(#{1,4})\s+(.*)$/', $line, $m ) ) {
$flush();
if ( $list ) {
$html .= "\n";
$list = false;
}
$level = min( 4, strlen( $m[1] ) );
$html .= "