volca / markdown-preview

Markdown Preview Plus -- Enables Chrome to render markdown files as HTML
https://chrome.google.com/webstore/detail/markdown-preview-plus/febilkbfcbhebfnokafefeacimjdckgl
MIT License
237 stars 73 forks source link

Request: permit manually specifying highlighting language in Markdown fenced blocks #113

Closed cxw42 closed 4 years ago

cxw42 commented 4 years ago

Thank you for this extension, which is very useful! I would like to be able to manually specify the highlighting language so that I can un-highlight plain text blocks. For example, I am seeing highlighting in ls -l ; sha256sum output:

image

As far as I can tell, only automatic language detection is currently supported:

https://github.com/volca/markdown-preview/blob/8b0d0293a219d07a7b06fb397fc4c8e4e51b6e40/js/config.js#L12-L14

I see from its docs that highlightjs can take a language parameter using highlight(). I would like Markdown Preview Plus to read the language tags from fenced code blocks such as below, and pass those language tags to highlight().

```text
-rw-r--r-- 1 root root ...
````

(with the text tag)

I may be able to work on this if you are not able to, but would certainly appreciate any advice you could provide! Much appreciated!

volca commented 4 years ago

Please update to v0.7.9 after hours

cxw42 commented 4 years ago

Thank you very much for your quick response! I see that 0.7.10 is out. I'll give it a try!