File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 1818 "phpdocumentor/reflection-docblock" : " ^5.0" ,
1919 "gitonomy/gitlib" : " ^1.2" ,
2020 "cebe/markdown" : " ^1.2" ,
21- "paquettg/php-html-parser " : " ^3.1 "
21+ "voku/simple_html_dom " : " ^4.7 "
2222 },
2323 "autoload" : {
2424 "psr-4" : {"PHPFUI\\ InstaDoc\\ " : " src/PHPFUI/InstaDoc/" }
Original file line number Diff line number Diff line change @@ -32,19 +32,18 @@ public function text(string $markdown) : string
3232 $ div = new \PHPFUI \HTML5Element ('div ' );
3333 $ div ->addClass ('markdown-body ' );
3434 $ html = $ this ->parser ->parse ($ markdown );
35- $ dom = new \PHPHtmlParser \Dom ();
36- $ dom ->setOptions ((new \PHPHtmlParser \Options ())->setPreserveLineBreaks (true ));
37- $ dom ->loadStr ($ html );
35+ $ dom = new \voku \helper \HtmlDomParser ($ html );
3836 $ codeBlocks = $ dom ->find ('.language-PHP ' );
37+
3938 foreach ($ codeBlocks as $ block )
4039 {
4140 $ child = $ block ->firstChild ();
4241 $ highlighted = $ hl ->highlight ('php ' , $ child ->text ());
4342 $ block ->setAttribute ('class ' , 'hljs ' . $ highlighted ->language );
44- $ block ->getParent ()->setAttribute ('class ' , 'hljs ' . $ highlighted ->language );
45- $ child ->setText ( \htmlspecialchars_decode ($ highlighted ->value ) );
43+ $ block ->parentNode ()->setAttribute ('class ' , 'hljs ' . $ highlighted ->language );
44+ $ child ->plainText = \htmlspecialchars_decode ($ highlighted ->value );
4645 }
47- $ div ->add ($ dom );
46+ $ div ->add ("{ $ dom}" );
4847
4948 return $ div ;
5049 }
You can’t perform that action at this time.
0 commit comments