md-to-pdf icon indicating copy to clipboard operation
md-to-pdf copied to clipboard

feature: Supporting marked plugins

Open tothlp opened this issue 10 months ago • 6 comments

Problem:

Marked has some pretty awesome plugins, like alert and footnote, but I can't get to figure out how to use them with md-to-pdf. I believe that upgrading the marked library is needed.

Solution:

I want to be able to use marked extensions. see: https://github.com/bent10/marked-extensions?tab=readme-ov-file#packages

tothlp avatar Apr 04 '24 18:04 tothlp

I think it's basically this: #228.

With a .js config file you can already use extensions IIRC, via the marked_extensions config option, but I don't remember how it works exactly 🙈 you can probably find some info by searching the issues (:

Upgrading Marked is also on the todo list. I don't receive any sponsoring for this project so things take a while at this point with small children at home 🙃

simonhaenisch avatar Apr 05 '24 07:04 simonhaenisch

Thanks a lot for the tip, I will check it out! Can I update this issue, if I figure something out?

tothlp avatar Apr 08 '24 08:04 tothlp

Yes please!

simonhaenisch avatar Apr 08 '24 09:04 simonhaenisch

I'm afraid, that the plugins that can be passed to marked.use() are limited by the given marked version number. As I see these are the supported plugins for marked version 4.2.12. (I believe that is what md-to-pdf uses). So I think that alert and footnote can not be used with this.

https://github.com/markedjs/marked/blob/v4.2.12/docs/USING_ADVANCED.md#known-extensions

tothlp avatar Apr 09 '24 14:04 tothlp

Ok i'm planning to upgrade Marked though, would that solve the compatibility problem?

simonhaenisch avatar Apr 10 '24 08:04 simonhaenisch

I'm sorry, I did not see that comment somehow. Yes, I believe, it would. I am not an expert at all with these libs as I develop mainly in Kotlin, but I think it is worth a try. :)

tothlp avatar Apr 27 '24 20:04 tothlp