chobie / php-sundown

php-sundown is just simple wrapper of sundown
Other
137 stars 16 forks source link

Rendering the TOC with Sundown\Markdown #18

Closed stof closed 12 years ago

stof commented 12 years ago

The simple Sundown class has a toTOC method to render the TOC. Is there a similar method for the dvanced markdown parser ?

chobie commented 12 years ago

thanks spotting the issue. I'm forget about that.

I implemented that in current development branch. I'll publish it to PECL in this weekend.

https://github.com/chobie/php-sundown/compare/1dbfb0a6...1e3bf311

<?php
$sd = new Sundown\Markdown(new Sundown\Render\HTML_TOC());
$data = "# helo

lorem ipsum dolar sit amet

## world

lorem ipsum dolar sit amet
";

echo $sd->render($data);
$sd->setRender(new Sundown\Render\HTML(array("with_toc_data"=>true)));
echo "\n";
echo $sd->render($data);

Thanks