* * Original code based on the followings: * - CommonMark JS reference parser (https://bitly.com/commonmark-js) (c) John MacFarlane * - league/commonmark (https://github.com/thephpleague/commonmark) (c) Colin O'Dell * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ require_once __DIR__.'/src/bootstrap.php'; use Dokuwiki\Plugin\Commonmark\Commonmark; if(!defined('DOKU_INC')) die(); class action_plugin_commonmark extends DokuWiki_Action_Plugin { /** * pass text to Commonmark parser before DW parser */ public function register(Doku_Event_Handler $controller) { $controller->register_hook('PARSER_WIKITEXT_PREPROCESS', 'BEFORE', $this, '_commonmarkparse'); } /** * Parse commonmark text * TEST: to "PASSED!!" */ public function _commonmarkparse(Doku_Event $event, $param) { if (preg_match('/\A/',$event->data)) { $event->data = Commonmark::RendtoDW(preg_replace('/\A/','',$event->data)); #$event->data = "PASSED"; } } }