Prism JS Support
Is it possible to have Mark2 recognize prism's code block language identifier? For instance in normal markdown a codeblock would be generated by typing:
```javascript
however in prism it done as:
```language-javascript
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Brett on 30 Aug, 2020 01:05 PM
It's possible, but not simple. Are you using PrismJS in Marked? Can you explain to me why you need to do this, and if you think enough users would be affected to make it worth adding the feature?
- Brett
2 Posted by Noel on 02 Sep, 2020 11:40 AM
Hi Brett,
I am using Devonthink (DT) to store all my code snippets/notes using Prism to highlight each languge in markdown however when I try to create a PDF to share, the code gets wonky. If Marked could handle the Prism language- prefix, I could share the code via the many templates in Marked since not everyone prefers code on a black background.
Attached is a screenshot of how the markdown is rendered in DT. DT out of the box comes with Prism JS however only for a few languages but if one needs other languages, they can create their own custom Prism JS file. Based on seeing a big increase in the number of languages now supported by Prism JS, I would say that there are enough users.
Support Staff 3 Posted by Brett on 02 Sep, 2020 07:19 PM
Ok, I'll take this under consideration.
Thanks,
Brett
Support Staff 4 Posted by Brett on 02 Sep, 2020 07:23 PM
You know, one option would be to use a custom preprocessor that just did
a search and replace for the `language-` prefix and removed it...
-Brett
5 Posted by Noel on 03 Sep, 2020 11:35 AM
Awesome, I'll have a look.
Thanks
Support Staff 6 Posted by Brett on 03 Sep, 2020 12:40 PM
FYI, I've added support for the next update.;
7 Posted by Noel on 05 Sep, 2020 09:14 AM
Great, thanks again!
Brett closed this discussion on 25 Sep, 2020 04:21 PM.