nue
nue copied to clipboard
Allow adding Marked Extensions in NueJS
Hey I noticed nuemark uses marked as the underlying library. Is there an easy way to add marked extensions for things like footnotes?
Originally posted by @indifferentghost in https://github.com/nuejs/nue/discussions/159#discussioncomment-8126684
I think this deserves its own issue for tracking.
According to the docs there does seem to be some add-ons. Also shouldn't this be in #170?
Yes. It is a valid notice, that this is connected to that issue, but I wouldn't say that it's completely the same. We'll see.
As for the add-ons list: Yes, Marked supports these extensions, but there currently is no proper system in place to pass the extensions through Nue to the marked instance. :)
I've already looked into dynamically importing a (js-)file with the user added extensions (provided as relative file path in the site.yaml
), but you need to have the base project directory path, as well as the extension file path available from inside of Nuemark (not nuekit). (As of the current project structure)
This can be achieved okay-ish. But I'll look around some more for a better way. But maybe someone else has a better implementation in mind.
Ah okay. What I was thinking for this was a use library-x
directly in the markup, and then on building it fetches all of the necessary add-ons.
Quite the interesting idea 👀, but not sure how good that would work, as you sometimes want to change configuration options for the (Marked) extensions. Sometimes even with JS, which is the reason, that I wouldn't include the config directly in the site.yaml
Ah, didn't realize that you could configure the addons as well. Hmm, then yeah it probably makes since to have it in a config file.
See: https://github.com/nuejs/nue/pull/230#issuecomment-2395513869