-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathMarkdown.php
More file actions
27 lines (21 loc) · 775 Bytes
/
Markdown.php
File metadata and controls
27 lines (21 loc) · 775 Bytes
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
<?php
class Markdown extends ParsedownExtra{
protected function identifyAtx($line){
$array = parent::identifyAtx($line);
$id = self::generateId($array['element']['text']);
$array['element']['attributes'] = array('id' => $id);
return $array;
}
static public function generateId($title){
return str_replace(' ', '-',
str_replace(array('(', ')', '?', '¿'), '', strtolower($title))
);
}
protected function identifyLink($Excerpt){
$r = parent::identifyLink($Excerpt);
if(isset($r['element']['name']) && $r['element']['name'] == 'img'){
$r['element']['attributes']['src'] = '/doc/'.$r['element']['attributes']['src'];
}
return $r;
}
}