Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[✨] Add extra syntax highlighters via. MDX config #86

Closed
absolutejam opened this issue Mar 31, 2023 · 4 comments
Closed

[✨] Add extra syntax highlighters via. MDX config #86

absolutejam opened this issue Mar 31, 2023 · 4 comments
Labels
[STAGE-2] incomplete implementation Remove this label when implementation is complete [STAGE-2] not fully covered by tests yet Remove this label when tests are verified to cover the implementation [STAGE-2] unresolved discussions left Remove this label when all critical discussions are resolved on the issue [STAGE-3] docs changes not added yet Remove this label when the necessary documentation for the feature / change is added [STAGE-3] missing 2 reviews for RFC PRs Remove this label when at least 2 core team members reviewed and approved the RFC implementation

Comments

@absolutejam
Copy link

absolutejam commented Mar 31, 2023

Is your feature request related to a problem?

Currently, I cannot seem to register extra languages to refractor as it is run as part of the Vite build process via. a plugin.

As you can see, this does register the tsx syntax but nothing else - https://github.com/BuilderIO/qwik/blob/6f3f0ef5a8eb472a9dab0e934a5327dd1005cfb2/packages/qwik-city/buildtime/markdown/syntax-highlight.ts

Describe the solution you'd like

Allow specifying additional languages to be registered.

This might be best done via. a 'setup' callback, which has access to the Refractor object:

// vite.config.ts

import fsharp from "refractor/lang/fsharp";

export default defineConfig(async () => {
  return {
    plugins: [
      qwikCity({
        mdxPlugins: {
          // as well as a `boolean`, also allow taking a config object
          rehypeSyntaxHighlight: {
            enabled: true,
            setup: (refractor: Refractor) => {
              refractor.register(fsharp)
            }
          }
        }
      })
    ]
  }

This setup callback would be passed to the rehypeSyntaxHighlight plugin and called there.

Describe alternatives you've considered

I tried to import refractor and register new languages in the root.tsx as part of a useTask$ but it had no effect.

Additional context

No response

@absolutejam
Copy link
Author

Just to confirm, I'm happy to take a crack at this if it looks like the right approach

@Lionardo
Copy link

Lionardo commented Apr 4, 2023

I am not sure if I am right with my issue but when I try to install react-markdown
the markdown component throws errors. Do I need to register this plugin also?

@manucorporat
Copy link

should be easy to add a PR! anybody open for it?

@gioboa
Copy link
Member

gioboa commented Oct 14, 2024

We moved this issue to qwik-evolution repo to create a RFC discussion for this.
Here is our Qwik RFC process thanks.

@gioboa gioboa transferred this issue from QwikDev/qwik Oct 14, 2024
@github-actions github-actions bot added [STAGE-2] incomplete implementation Remove this label when implementation is complete [STAGE-2] not fully covered by tests yet Remove this label when tests are verified to cover the implementation [STAGE-2] unresolved discussions left Remove this label when all critical discussions are resolved on the issue [STAGE-3] docs changes not added yet Remove this label when the necessary documentation for the feature / change is added [STAGE-3] missing 2 reviews for RFC PRs Remove this label when at least 2 core team members reviewed and approved the RFC implementation labels Oct 14, 2024
@QwikDev QwikDev locked and limited conversation to collaborators Oct 14, 2024
@gioboa gioboa converted this issue into discussion #162 Oct 14, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
[STAGE-2] incomplete implementation Remove this label when implementation is complete [STAGE-2] not fully covered by tests yet Remove this label when tests are verified to cover the implementation [STAGE-2] unresolved discussions left Remove this label when all critical discussions are resolved on the issue [STAGE-3] docs changes not added yet Remove this label when the necessary documentation for the feature / change is added [STAGE-3] missing 2 reviews for RFC PRs Remove this label when at least 2 core team members reviewed and approved the RFC implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants