BenjaminHoegh / ParsedownExtended

ParsedownExtended is an extention for Parsedown, offering additional features and functionalities.
https://benjaminhoegh.github.io/ParsedownExtended
MIT License
37 stars 7 forks source link

Questions on the included modules (ParsedownMath and ParsedownTOC) #14

Closed BrainStone closed 4 years ago

BrainStone commented 4 years ago

Hi there. Sorry if this is not the right place, but here goes nothing.

So I'm struggling to get the inline TOC to work with [toc]. Do I need to enable it somehow?

Also what's the difference between enableMath and enableKatex? Don't they both enable parsing of math blocks? What happens when I enable both?

BrainStone commented 4 years ago

Now looking at the whole thing, enableMath doesn't seem to exists and what does enabling KaTeX even do? I can see no difference in the generated HTML...

Nevermind. Found the issue. All good in the department of there being no difference

BenjaminHoegh commented 4 years ago

sorry for the bad documentation, I'm not that good at writing English.

Also what's the difference between enableMath and enableKatex?

My mistake, there should only be one

So I'm struggling to get the inline TOC

Can you show the code there include the TOC ?

BrainStone commented 4 years ago

I add [toc] to the markdown, as mentioned here: https://github.com/BenjaminHoegh/parsedown-toc#usage

And it just prints [toc] as is.

BenjaminHoegh commented 4 years ago

I add [toc] to the markdown, as mentioned here: https://github.com/BenjaminHoegh/parsedown-toc#usage

And it just prints [toc] as is.

Oh I see, my bad. I have updated the documentation now.

To enable [toc] in your markdown document you have to use the following code:

$body = file_get_contents('test1.md');
$Parsedown->toc([
    'selector' => ['h1','h2','h3','h4','h5','h6'],
    'inline' => true
]);
echo $Parsedown->text($body);
BrainStone commented 4 years ago

Awesome. Thanks!

BrainStone commented 4 years ago

No that doesn't work. That's the error I get:

Call to undefined method ParsedownExtreme::toc()
BenjaminHoegh commented 4 years ago

Sorry for all the trouble you have. I will investigate this today and hopefully publish a fix for this later today