1<?php 2/** 3 * Action plugin to include TikZJax script and styles 4 */ 5class action_plugin_tikzjax extends DokuWiki_Action_Plugin { 6 7 /** 8 * Register the events 9 * 10 * @param Doku_Event_Handler $controller 11 */ 12 public function register(Doku_Event_Handler $controller) { 13 $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'add_tikzjax_headers'); 14 } 15 16 /** 17 * Add TikZJax script and stylesheet to the meta headers 18 * 19 * @param Doku_Event $event 20 * @param mixed $param 21 */ 22 public function add_tikzjax_headers(Doku_Event $event, $param) { 23 $event->data['link'][] = [ 24 'rel' => 'stylesheet', 25 'type' => 'text/css', 26 'href' => 'https://tikzjax.com/v1/fonts.css' 27 ]; 28 29 $event->data['script'][] = [ 30 'type' => 'text/javascript', 31 'src' => 'https://tikzjax.com/v1/tikzjax.js', 32 '_data' => '' 33 ]; 34 } 35}