Prism JS Support

Noel's Avatar

Noel

30 Aug, 2020 09:58 AM

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

  1. Support Staff 1 Posted by Brett on 30 Aug, 2020 01:05 PM

    Brett's Avatar

    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. 2 Posted by Noel on 02 Sep, 2020 11:40 AM

    Noel's Avatar

    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.

  3. Support Staff 3 Posted by Brett on 02 Sep, 2020 07:19 PM

    Brett's Avatar

    Ok, I'll take this under consideration.

    Thanks,
    Brett

  4. Support Staff 4 Posted by Brett on 02 Sep, 2020 07:23 PM

    Brett's Avatar

    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. 5 Posted by Noel on 03 Sep, 2020 11:35 AM

    Noel's Avatar

    Awesome, I'll have a look.

    Thanks

  6. Support Staff 6 Posted by Brett on 03 Sep, 2020 12:40 PM

    Brett's Avatar

    FYI, I've added support for the next update.;

  7. 7 Posted by Noel on 05 Sep, 2020 09:14 AM

    Noel's Avatar

    Great, thanks again!

  8. Brett closed this discussion on 25 Sep, 2020 04:21 PM.

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