[FEATURE] Auto Language Detect or Default language

🆓
Adds syntax highlighting to code blocks using prism.js


Post Reply
DAE avatar
Raheem
Novice
Novice
Posts: 3
Joined: 04 Sep 2020 10:54
Location: Egypt
Contact:

[FEATURE] Auto Language Detect or Default language

Post by Raheem »

Hello,

Can you add if the user does not define any language like [code][/code], then the extension automatically detects the language instead of leaving it as plain text? Or if this cannot be done, if the user does not define the language how can I set default language like C instead of plain text?

Thank you.


User avatar
3Di
Founder
Founder
Posts: 1265
Joined: 12 Mar 2018 20:10
Location: Milan (IT) Frankfurt (DE)
Contact:

[FEATURE] Auto Language Detect

Post by 3Di »

Thank you for your request, we will see what we can do.

🏥 Honour and respect to all our heroes in health care. 🇮🇹
Looking for a specific solution for your site? We will rock you! 🚀


DAE avatar
Raheem
Novice
Novice
Posts: 3
Joined: 04 Sep 2020 10:54
Location: Egypt
Contact:

[FEATURE] Auto Language Detect

Post by Raheem »

Thank you for your efforts and for this great extension : )


User avatar
3Di
Founder
Founder
Posts: 1265
Joined: 12 Mar 2018 20:10
Location: Milan (IT) Frankfurt (DE)
Contact:

[FEATURE] Auto Language Detect

Post by 3Di »

Unfortunately this feature is not available in PrismJS, has been already requested there but the developers said:

… we will not be implementing this.

https://github.com/PrismJS/prism/issues ... -535526127


About the fallback request you posted

Raheem wrote:
04 Sep 2020 10:58

if this cannot be done, if the user does not define the language how can I set default language like C instead of plain text

I haven’t investigated this option yet, if possible though it will be added.

🏥 Honour and respect to all our heroes in health care. 🇮🇹
Looking for a specific solution for your site? We will rock you! 🚀


User avatar
3Di
Founder
Founder
Posts: 1265
Joined: 12 Mar 2018 20:10
Location: Milan (IT) Frankfurt (DE)
Contact:

[FEATURE] Auto Language Detect or Default language

Post by 3Di »

The simplest solution is to add a custom BBcode in your case.
This one works here, it is a copy of the native CODE bbcode adapted for C, only for it.


BBCode usage

[code-C]{TEXT}[/code-C]


HTML replacement

<div class="codebox"><p>{L_CODE}{L_COLON} <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></p><pre class=" language-c"><code class=" language-c">{TEXT}</code></pre></div>

Help line

Code C display: [code-C]code[/code-C]


immagine.png

immagine.png

immagine.png

🏥 Honour and respect to all our heroes in health care. 🇮🇹
Looking for a specific solution for your site? We will rock you! 🚀


DAE avatar
Raheem
Novice
Novice
Posts: 3
Joined: 04 Sep 2020 10:54
Location: Egypt
Contact:

[FEATURE] Auto Language Detect or Default language

Post by Raheem »

3Di wrote:
04 Sep 2020 21:54

The simplest solution is to add a custom BBcode in your case.
This one works here, it is a copy of the native CODE bbcode adapted for C, only for it.

This is very good solution, I’ll use. Many thanks :).

Last edited by 3Di on 04 Sep 2020 22:51, edited 1 time in total.
Reason: Removed long quote ;)

User avatar
3Di
Founder
Founder
Posts: 1265
Joined: 12 Mar 2018 20:10
Location: Milan (IT) Frankfurt (DE)
Contact:

[FEATURE] Auto Language Detect or Default language

Post by 3Di »

Anytime. ;)

🏥 Honour and respect to all our heroes in health care. 🇮🇹
Looking for a specific solution for your site? We will rock you! 🚀


Post Reply