-
Notifications
You must be signed in to change notification settings - Fork 0
/
Example.php
36 lines (27 loc) · 816 Bytes
/
Example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
// basic namespace
use de\andidittrich\lightup\LightUp;
// you should use your prefered autoloading method
require('Source/LightUp.php');
require('Source/LineTokenizer.php');
require('Source/Renderer.php');
// default md document to parse
$documentName = 'README.md';
// try to get markdown source document
if (isset($_GET['doc'])){
$filename = 'Resources/'.preg_replace('/[^A-Za-z]/', '', $_GET['doc']).'.md';
if (file_exists($filename)){
$documentName = $filename;
}
}
// some LightUp options
$options = array(
'highlightingMode' => 'enlighterjs'
);
// get the demo content
$demo1Raw = file_get_contents($documentName);
// render markdown as html
$pageContent = LightUp::render($demo1Raw, $options);
// and display it within the template-file
include('Resources/BootstrapTemplate.phtml');
?>