Last active
December 30, 2015 23:39
-
-
Save simplistik/7901838 to your computer and use it in GitHub Desktop.
Hook Markdown into Tablepress with Parsedown http://wordpress.org/plugins/tablepress/
https://github.com/erusev/parsedown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Client extends Setup | |
{ | |
public function __construct() | |
{ | |
add_filter('process_markdown', array($this, 'process_markdown')); | |
add_filter('tablepress_cell_content', array($this, 'process_markdown')); | |
} | |
public function process_markdown($text) | |
{ | |
if ( in_array($text, array('#colspan#', '#rowspan#', '#span#')) ) return $text; | |
if ( file_exists(THEMEEXTENSIONS . '/functions/parsedown.php') ) | |
require_once(THEMEEXTENSIONS . '/functions/parsedown.php'); | |
else | |
return $text; | |
$markdown = Parsedown::instance()->parse($text); | |
return $markdown; | |
} | |
} | |
new Client; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment