forked from michelf/php-smartypants
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Readme.php
36 lines (31 loc) · 957 Bytes
/
Readme.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
// This file passes the content of the Readme.md file in the same directory
// through the SmartyPants filter. You can adapt this sample code in any way
// you like.
//
// ! NOTE: This file requires Markdown to be available on the include path to
// parse the readme file.
// Install PSR-0-compatible class autoloader
spl_autoload_register(function($class){
require preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php';
});
// Get SmartyPants and Markdown classes
use Michelf\SmartyPants;
use Michelf\MarkdownExtra;
// Read file and pass content through the Markdown praser
$text = file_get_contents('Readme.md');
$html = MarkdownExtra::defaultTransform($text);
$html = SmartyPants::defaultTransform($html);
?>
<!DOCTYPE html>
<html>
<head>
<title>PHP Smartypants Lib - Readme</title>
</head>
<body>
<?php
# Put HTML content in the document
echo $html;
?>
</body>
</html>