Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created August 31, 2016 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/2fef5b422952914331f90e694bf8860f to your computer and use it in GitHub Desktop.
Save billerickson/2fef5b422952914331f90e694bf8860f to your computer and use it in GitHub Desktop.
<?php
/**
* Strong Markdown
*
*/
function ea_strong_markdown( $text ) {
$strong_character = '*';
if( 2 == substr_count( $text, $strong_character ) ) {
$text = substr_replace( $text, '<strong>', strpos( $text, $strong_character ), strlen( $strong_character ) );
$text = substr_replace( $text, '</strong>', strrpos( $text, $strong_character ), strlen( $strong_character ) );
}
return $text;
}
/**
* Line Break Markdown
*
*/
function ea_br_markdown( $text ) {
$br_character = '|';
$text = str_replace( $br_character, '<br />', $text );
return $text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment