1*ad615f37SSungbin Jeon<?php 2*ad615f37SSungbin Jeon/** 3*ad615f37SSungbin Jeon * Commonmark Plugin test 4*ad615f37SSungbin Jeon */ 5*ad615f37SSungbin Jeon 6*ad615f37SSungbin Jeonif(!defined('DOKU_INC')) die(); 7*ad615f37SSungbin Jeon 8*ad615f37SSungbin Jeonclass action_plugin_commonmark extends DokuWiki_Action_Plugin { 9*ad615f37SSungbin Jeon /** 10*ad615f37SSungbin Jeon * pass text to Commonmark parser before DW parser 11*ad615f37SSungbin Jeon */ 12*ad615f37SSungbin Jeon public function register(Doku_Event_Handler $controller) { 13*ad615f37SSungbin Jeon $controller->register_hook('PARSER_WIKITEXT_PREPROCESS', 'BEFORE', $this, 14*ad615f37SSungbin Jeon '_commonmarkparse'); 15*ad615f37SSungbin Jeon } 16*ad615f37SSungbin Jeon 17*ad615f37SSungbin Jeon /** 18*ad615f37SSungbin Jeon * Parse commonmark text 19*ad615f37SSungbin Jeon * TEST: <!DOCTYPE markdown> to "PASSED!!" 20*ad615f37SSungbin Jeon */ 21*ad615f37SSungbin Jeon public function _commonmarkparse(Doku_Event $event, $param) { 22*ad615f37SSungbin Jeon if (preg_match('/\A<!DOCTYPE markdown>/',$event->data)) { 23*ad615f37SSungbin Jeon $event->data = "===== WILL DW RENDERING WORK? ====="; 24*ad615f37SSungbin Jeon } 25*ad615f37SSungbin Jeon 26*ad615f37SSungbin Jeon } 27*ad615f37SSungbin Jeon 28*ad615f37SSungbin Jeon}