jrblevin / markdown-mode

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

Wrong gfm-view-mode syntax highlight if only using *-ts-mode (tree-sitter modes) #824

Open LionyxML opened 4 months ago

LionyxML commented 4 months ago

Expected Behavior

(gfm-mode)

```typescript

const result = 1 + 1;

console.log(result); ```

to be rendered as (gfm-view-mode): image

Actual Behavior

(gfm-mode)

```typescript

const result = 1 + 1;

console.log(result); ```

being rendered as (gfm-view-mode): image

Steps to Reproduce

Have a system configured for treating typescript with treesitter and have no typescript-mode installed (such a config can be find here: https://github.com/LionyxML/lemacs/blob/main/init.el).

Open a new buffer and paste the content: ```typescript

const result = 1 + 1;

console.log(result); ```

Remove the \ as this is only for writing it here on github...

Run M-x gfm-view mode.

Note: This problem goes away if I do install typescript-mode:

(use-package typescript-mode
  :defer t
  :ensure t)

Problem is that treesit modes replaces lots of "classic style modes", some for which there's actually no "mode package" for Emacs, but there's a tree sitter parser (like some obscure parsers you can find on this list: https://github.com/nvim-treesitter/nvim-treesitter).

Is there a way of making markdown-mode see "typescript" and actually use "typescript-ts-mode" for syntax highlighting?

A list converting modes or a global option to turn on/off such feature would be really nice.

Backtrace

No backtrace

Software Versions

kiennq commented 2 months ago

In the mean time, I guess something like (fset 'typescript-mode 'typescript-ts-mode) might work