Skip to content

Instantly share code, notes, and snippets.

@ryanburnette
Last active January 12, 2016 07:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanburnette/0fc9b9ab1eb41877ffd3 to your computer and use it in GitHub Desktop.
Save ryanburnette/0fc9b9ab1eb41877ffd3 to your computer and use it in GitHub Desktop.
WordPress filters for converting to and from Markdown using WP-Markdown plugin.
<?php
// functions.php
if ( function_exists(wpmarkdown_markdown_to_html) && function_exists(wpmarkdown_html_to_markdown) ) {
function markdown_to_html_func($content) {
if ( function_exists('wpmarkdown_markdown_to_html') ) {
return wpmarkdown_markdown_to_html($content);
}
return $content;
}
add_filter('markdown_to_html','markdown_to_html_func');
function html_to_markdown_func($content) {
if ( function_exists('wpmarkdown_html_to_markdown') ) {
return wpmarkdown_html_to_markdown($content);
}
return $content;
}
add_filter('html_to_markdown','html_to_markdown_func');
}
?>
@manojhl
Copy link

manojhl commented May 8, 2014

Its better to have it inside the wp-markdown core itself..... :D

@ryanburnette
Copy link
Author

@manojhl Stephen didn't see the need to put this into the core the last time I spoke with him about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment