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

Adding more syntax highlighting #15

Closed
devMYC opened this issue Jun 13, 2022 · 6 comments
Closed

Adding more syntax highlighting #15

devMYC opened this issue Jun 13, 2022 · 6 comments

Comments

@devMYC
Copy link

devMYC commented Jun 13, 2022

It seems that gfm has turned on syntax highlighting for JavaScript, Markdown, and HTML by default. And I saw that syntax highlighting for C is also supported by this repo.

import "https://esm.sh/prismjs@1.27.0/components/prism-c?no-check";

Is there a preferred way to support other languages?

@bartlomieju
Copy link
Member

Currently there's no options, we should add a new key to BlogSettings interface to configure that

@yidingww
Copy link
Contributor

@devMYC You can directly import the additional prismjs components/plugins to your actual blog project main.js/ts file, and it will work.

For me, I created a prismjs-extensions.ts file like this

import "https://esm.sh/prismjs@1.27.0/components/prism-typescript";
import "https://esm.sh/prismjs@1.27.0/components/prism-ruby";
import "https://esm.sh/prismjs@1.27.0/components/prism-python";
import "https://esm.sh/prismjs@1.27.0/components/prism-go";

Then in my main.ts i just import the bucket over above the blog({...}), it will just work

import "./prismjs-extensions.ts";

blog({
  ...
})

@devMYC
Copy link
Author

devMYC commented Jul 12, 2022

@yidingww I will give it a try, thanks.

@gofenix
Copy link
Contributor

gofenix commented Dec 20, 2022

@yidingww awesome, it works for me.

@devMYC devMYC closed this as completed Dec 20, 2022
@sigmaSd
Copy link

sigmaSd commented Feb 6, 2023

I tried import "https://esm.sh/prismjs@1.27.0/components/prism-rust" but it fails with

error: Uncaught ReferenceError: Prism is not defined
    at https://esm.sh/v99/prismjs@1.27.0/deno/components/prism-rust.js:2:3014
    at https://esm.sh/v99/prismjs@1.27.0/deno/components/prism-rust.js:2:203
    at https://esm.sh/v99/prismjs@1.27.0/deno/components/prism-rust.js:2:3031```

@kyeotic
Copy link
Contributor

kyeotic commented Apr 30, 2023

Is there any way to change the prism theme?

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

No branches or pull requests

6 participants