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

Code highlighting #12

Open
thomasheartman opened this issue May 8, 2020 · 0 comments
Open

Code highlighting #12

thomasheartman opened this issue May 8, 2020 · 0 comments

Comments

@thomasheartman
Copy link

@thomasheartman thomasheartman commented May 8, 2020

Hi,

Thanks for the work on the package; it's the one thing that made it a viable choice for me to switch over to Gatsby, so I'm very grateful.

I've got a question about code highlighting. In the example, the first JS example is highlighted. The gatsby-config file in this repo also seems to indicate that highlighting should be automatic:

        // if you don't want to have server side prism code highlight
        // noHighlight: true,

However, it doesn't seem to work for me, so I'm wondering how it's supposed to work? I tried both with and without :exports code, with rust, toml, and js, but there's no highlighting going on.

I was able to make prismjs work by using the remark plugin as below, though:

    {
      resolve: `gatsby-transformer-orga`,
      options: {
        plugins: [
          {
            resolve: `gatsby-remark-prismjs`,
            options: {
              aliases: { sh: "bash" },
              showLineNumbers: true,
            },
          },
        ],
      },
    },

but the root pre tags don't have the right class attached, so I need to manually set their background color. It's a hack, but it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant