question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some languages supported by Prism.js are not rendered in the codesample plugin

See original GitHub issue

Configuring custom languages and CSS in the configuration of the codesample is not enough to provide proper rendering for some languages supported by Prism.js.

To reproduce

Access the following fiddle (using any version of TinyMCE to this day) : http://fiddle.tinymce.com/zagaab

Bug : The JSON sample is not properly highlighted/rendered in the TinyMCE editor.

chrome_2017-09-19_17-56-23

Expected : With an appropriate configuration, the following rendering is expected :

chrome_2017-09-19_17-55-54

Explanation The codesample plugin provides its own bundle of Prism :

Therefore, even though the codesample plugin can be configured to specify which languages are to be rendered and with which CSS, not all languages will be supported because the rendering engine is missing.

Requested fix

The codesample plugin should provide a configuration to define a custom Prism instance or JS Path to use for the rendering.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
lnewsoncommented, May 2, 2020

Hi,

This feature was added in TinyMCE 5.2, as you can now use the global PrismJS instance to render the codesamples within the editor. This can be enabled with the codesample_global_prismjs setting, which then allows custom languages to be used. Here’s an example showing Perl and PowerShell being added: http://fiddle.tinymce.com/6bhaab

As for the plugins mentioned in the second comment, theres already https://github.com/tinymce/tinymce/issues/2771 and https://github.com/tinymce/tinymce/issues/4481 open for that so I’m going to go ahead and close this since the original request has been implemented.

Thanks!

0reactions
lnewsoncommented, May 4, 2020

@SantuarioParra this was about using different languages, not themes. Themes are controlled via CSS and as such are reliant on the content CSS you provide. As an example, here’s my example above adapted to use the dark PrismJS theme: http://fiddle.tinymce.com/6bhaab/1

Anyways, since this is a different issue, if you have any further issues please open a new issue instead. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prism.js
Extensible Define new languages or extend existing ones. Add new features thanks to Prism's plugin architecture. Easy styling All styling is done through...
Read more >
Add additional syntax highlighter plugin to PrismJS in HCL ...
I installed the TinyMCE editor on top of a fresh Connections 6.5.1 installation. While syntax highlighting using the codesample plugin is ...
Read more >
Code sample - custom prog. languages - TinyMCE
Hello, I have little problem with Code sample plugin, I would like to insert custom prog. languages like Sass, but I didn't find...
Read more >
Code Sample plugin | Docs - TinyMCE
The Code Sample plugin uses the following languages: markup, javascript, css, php, ruby, python, java, c, csharp and cpp. You can generate the...
Read more >
How to add code snippets using TinyMCE and Prism.js
Once you add the codesample plugin and the action button in the ... So you do not have to look the list of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found