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

Support processing sublist of tags #46

Closed
4 tasks done
Jareechang opened this issue Apr 9, 2023 · 2 comments
Closed
4 tasks done

Support processing sublist of tags #46

Jareechang opened this issue Apr 9, 2023 · 2 comments
Labels
🤷 no/invalid This cannot be acted upon 👎 phase/no Post cannot or will not be acted on

Comments

@Jareechang
Copy link

Initial checklist

Problem

Hello,

I am running my personal blog using unified and I am using this plugin.

The steps are as follow:

  1. Write in Markdown
  2. process with unified (+ rehype-parse and rehype-react)
  3. Run ReactDOM.renderToString
  4. Add onto the site

The problem is I already have an existing unified pipeline that handles markdown with code snippets but this new process integrating with the react components is breaking some things.

I have many code samples on the site using Typescript etc and it thinks those are react components.

For Example:

Array<string>

Solution

I think it would be great to support a new options - options.supportedTags .

What it will include: list of tags (ie ['p', 'a', ...])

Type: Array

It will have the following behaviours:

  • If there are no tags defined, default to original behaviour (parsing everything)
  • If tags are defined, only run the processing on the listed tags

Alternatives

I mean technically I can pass in all those tags into the options.components but that is a pain because every time I write a blog post with snippets using Typescript, I would need to update the list.

I am open to other solutions though.

Let me know I can make a PR for this with tests.

I am happy to support it (It would be great to have for me) 🙏

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Apr 9, 2023
@wooorm
Copy link
Member

wooorm commented Apr 9, 2023

Hey! I don’t quite understand what you mean.
Can you share a summary of the two processes you have?

breaking some things.

Which things?

I have many code samples on the site using Typescript etc and it thinks those are react components.

Can you explain? Who thinks that?

@wooorm wooorm closed this as not planned Won't fix, can't repro, duplicate, stale Aug 26, 2023
@wooorm wooorm added the 🤷 no/invalid This cannot be acted upon label Aug 26, 2023
@github-actions

This comment has been minimized.

@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤷 no/invalid This cannot be acted upon 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

2 participants