PHP   111

Highlighter

Guest on 22nd May 2022 04:22:24 AM

  1. <?php
  2. require_once __DIR__ . "/../Highlight/Autoloader.php";
  3. spl_autoload_register("Highlight\\Autoloader::load");
  4.  
  5. $hl = new Highlight\Highlighter();
  6. $r = $hl->highlight("html", file_get_contents(__FILE__));
  7. ?>
  8.  
  9. <html lang="en">
  10.     <head>
  11.         <title>highlight.php example</title>
  12.         <link rel="stylesheet" type="text/css" href="../styles/default.css">
  13.     </head>
  14.     <body>
  15.         <pre><code class="hljs <?=$r->language; ?>"><?=$r->value; ?></code></pre>
  16.     </body>
  17. </html>

Raw Paste


Login or Register to edit or fork this paste. It's free.