jrblevin / markdown-mode

Emacs Markdown Mode
http://jblevins.org/projects/markdown-mode/
GNU General Public License v3.0
901 stars 164 forks source link

Missing colored syntax highlighting #692

Open fuzunspm opened 2 years ago

fuzunspm commented 2 years ago

Expected Behavior

Syntax highlighting within code block seems missing. Example SS below. It looks a bit dull. Is it possible to configure it in a way that my emacs config does?

Software Versions

Screenshot of Markdown Mode

image

Screenshot of VSCode

image

Screenshot of Emacs config of the same code block in a .js file

image

syohex commented 2 years ago

Could you show us your javascript configuration ? By default, markdown-mode applies js-mode for js code block. If you use another major-mode, you need to modify markdown-code-lang-modes.

fuzunspm commented 2 years ago

how should i set it? below is not working

(setq markdown-code-lang-modes (("js" . 'rjsx-mode)))

syohex commented 2 years ago
(add-to-list 'markdown-code-lang-modes '("js" . rjsx-mode))

The configuration is like above snippet. However it looks that it doesn't work. js2-mode which rjsx-mode depends on does not work too. I don't understand why those modes don't work well.

syohex commented 2 years ago

Screenshot from 2022-03-04 23-02-09

js-mode and rainbow-delimiters-mode work well.

fuzunspm commented 2 years ago

Yes same here, raindow delimeters works only

wyuenho commented 1 month ago

js2-mode and rjsx-mode don't use emacs's font locking mechanism and use it's custom parser ported from Mozilla's Rhino. The way to fix this issue is to map js to the new js-mode or js-ts-mode