Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(remark): Support for passing through remarkRehype configuration #517

Closed
marcus-crane opened this issue Nov 28, 2023 · 8 comments
Closed
Labels
enhancement New feature or request

Comments

@marcus-crane
Copy link

marcus-crane commented Nov 28, 2023

Enter your suggestions in details:

Hey there,

I've been porting my site over to Lume, which has been quite enjoyable so far. My blog makes use of Littlefoot which is a small JS library for inlining footnotes.

With Lume, I'm also using Remark which is nice but by default, generates some footnotes with syntax that Littlefoot can't quite work with.

The fix for this is just to override how the footnotes are rendered but doing that requires being able to pass through some configuration to remarkRehype.

Unfortunately, it isn't possible to do this, as remarkRehype is initialised with some default settings and isn't reachable from _config.ts so I'd like to request that it be opened up for passthrough.

On a side note, and some of this is really down to Deno using URLs as identifiers, I was pleasantly surprised at how easy it was to pull the remark plugin into my site's repo and make this modification locally.

The references within will break over time of course so I'd still like to request it as something officially supported but it makes me feel a little easier that it's possible to reach into Lume's bowels a little bit for small patches without having to say; fork the entire codebase (not that I would bother to get that far)

I'd be happy to try and contribute a PR as well, although I'd have to have a think about what a good API might look like. I was a bit surprised to see that none of the existing remark config made use of types too 😅

Thanks again!

@marcus-crane marcus-crane added the enhancement New feature or request label Nov 28, 2023
@oscarotero
Copy link
Member

Hi @marcus-crane
Yeah, I think a rehypeOptions property would be nice. What do you think?
Feel free to PR this change, thank you!

@marcus-crane
Copy link
Author

Neat, I'll try and submit a PR sometime this week 🙂

@marcus-crane
Copy link
Author

@oscarotero Congrats on the launch of Lume 2! I was just about to get around to PRing this again and I've had it running for my site in production for a while now.

Maybe I missed it but I didn't see any explicit mention of whether the 1.x branch is frozen now? If so, I guess I can just reopen the PR I had previously that was created against Lume 2?

@kwaa
Copy link
Member

kwaa commented Dec 9, 2023

I think it has been implemented here: 7f123b2

but the MDX plugin doesn't support this yet.

@oscarotero Maybe we should refer to the @mdx-js/mdx options?

https://github.com/mdx-js/mdx/blob/d1fface103b90d2ef8d14d50b77cbfcf20b4bb71/packages/mdx/lib/core.js#L205-L214

  • rehypeOptions => remarkRehypeOptions

@marcus-crane
Copy link
Author

Ah neat, thanks for the heads up

@oscarotero
Copy link
Member

Hi @marcus-crane .
Yes, I implemented in Lume 2. But feel free to open a PR to add it to Lume 1 if you need it.
I will continue to give some support to Lume 1.

@oscarotero
Copy link
Member

@kwaa good idea!

oscarotero added a commit that referenced this issue Dec 9, 2023
@marcus-crane
Copy link
Author

Ah neat, I've upgraded my own site to v2.0 now and am successfully using the updates (from main branch currently) so I'm going to mark this issue as closed. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants