Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Highight Plugin] Improved language detection #1111

Merged
merged 1 commit into from
Jul 4, 2021

Conversation

mpryvkin
Copy link
Contributor

@mpryvkin mpryvkin commented May 1, 2020

Description

Adds new Highlight plugin options languageNames and languages allowing to hide certain languages by setting property with their name to null, change language name or add support for custom language by providing language ID and its name.

New functionality is optional and has to be enabled by using plugin option languageNames: true .

For example, to hide SVG language and rename HTML language:

$('#example').trumbowyg({
   btns: [
      ['highlight']
   ],
   plugins: {
      highlight: {
         languageNames: true,
         languages: {
            'svg': null,
            'html': 'Hypertext Markup Language'
         }
      }
   }
});

Examples

@mpryvkin
Copy link
Contributor Author

mpryvkin commented May 1, 2020

I used a jQuery trick ($('<div/>').text(value).html()) to encode HTML entities. If there is an internal method that can be used for the same purpose, please let me know and I will replace it.

@Alex-D Alex-D merged commit 603259a into Alex-D:develop Jul 4, 2021
@Alex-D
Copy link
Owner

Alex-D commented Jul 4, 2021

Thank you for your PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Highlight Plugin] Improve language detection
2 participants