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

[Feature] Syntax highlighting for code snippets in Markdown #10

Open
shubham0204 opened this issue Sep 3, 2024 · 2 comments
Open

[Feature] Syntax highlighting for code snippets in Markdown #10

shubham0204 opened this issue Sep 3, 2024 · 2 comments

Comments

@shubham0204
Copy link

It would be great to have language-specific syntax-highlighting for code snippets in the Markdown editor. I tried the following snippet in the editor,

image

but could not get syntax-highlighting for Java,

image

For technical blogposts, syntax highlighting helps viewers to read the code easily, and differentiates it from plain-text (which has no highlighting). I noticed that tunalog uses the SimpleMDE as the Markdown editor and proceeded to find these two issues concerning syntax-highlighting in SimpleMDE,

@shubham0204 shubham0204 changed the title Syntax highlighting for code snippets in Markdown [Feature] Syntax highlighting for code snippets in Markdown Sep 3, 2024
@YamiOdymel
Copy link
Member

Syntax highlighting works in the Post, but it's disabled in the Markdown Editor/Preview for a few reasons:

  1. The highlighting style differs between the Editor and the actual Post.

  2. Tunalog has a Theme feature, which the Markdown Preview can't accurately reflect in the final result.

Since both of these issues can cause confusion, I decided to disable it when I found that the editor on GitHub doesn't support syntax highlighting either. I'd like to hear your thoughts on this.

It originally worked in the Markdown Editor/Preview:

image

image

But it doesn’t look the same as what it will be in the final post result.

sshot-2024-09-03-12

@shubham0204
Copy link
Author

@YamiOdymel Considering the difference in syntax-highlighting, it seems that the one in the final post is entering some 'dark' theme. The other possibility is that the highlighting in the editor is entering the 'light' mode. Is it possible to change the theme of code snippets in the editor (maybe we can change it from 'light' to 'dark' somehow?).

Just my initial thoughts! I think having syntax highlighting is more important than the difference observed in the editor and final-post.

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

No branches or pull requests

2 participants