[ABD] Prism JS syntax highlighter ⚡️

Any abandoned Extensions will be moved to this forum.

WARNING: Extensions in this forum are not currently being supported or maintained by the original Extension author. Proceed at your own risk.
Forum rules
IMPORTANT: Extension Development Forum rules

WARNING: Extensions in this forum are not currently being supported nor updated by the original Extension author. Proceed at your own risk.
User avatar
Dark❶
Registered User
Posts: 395
Joined: Mon Jan 15, 2018 1:22 pm
Location: D@rK V0id
Name: Dark❶ [dark1]
Contact:

Re: [3.3][BETA] Prism JS syntax highlighter ⚡️

Post by Dark❶ »

3Di wrote: Fri Mar 19, 2021 11:17 am No probs, you might want to remove that (not working) link to that file? :)
Done :+1:

PR made here : https://github.com/phpBB-Studio/PrismSy ... ter/pull/1

Let me know if changes are required.

Best regards :+1:
Dark❶ [dark1]
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: [3.3][BETA] Prism JS syntax highlighter ⚡️

Post by 3Di »

Thx. Sure, the discussion tooks its place over there as of now.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
Dark❶
Registered User
Posts: 395
Joined: Mon Jan 15, 2018 1:22 pm
Location: D@rK V0id
Name: Dark❶ [dark1]
Contact:

Re: [3.3][BETA] Prism JS syntax highlighter ⚡️

Post by Dark❶ »

@3Di ,

I just got an idea on "line number",
it requires to manipulate in/via configurator,
but I do not know how to do that.

So here's my idea :

Code: Select all

[code=lang line_num=yes]...[//code]
if line_num=yes is found as attribute of [code]...[/code] then add CSS class line-numbers to it.

we already have this(https://prismjs.com/plugins/line-numbers/) plugin in current prism.js file.

Best regards :+1:
Dark❶ [dark1]
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: [3.3][BETA] Prism JS syntax highlighter ⚡️

Post by 3Di »

Yeah, just I am not a big fan of it, imagine you have a snippet then it doesn't obey the right line numbers... instead a whole file it could do. 😺
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
Dark❶
Registered User
Posts: 395
Joined: Mon Jan 15, 2018 1:22 pm
Location: D@rK V0id
Name: Dark❶ [dark1]
Contact:

Re: [3.3][BETA] Prism JS syntax highlighter ⚡️

Post by Dark❶ »

3Di wrote: Fri Mar 19, 2021 1:44 pm Yeah, just I am not a big fan of it, imagine you have a snippet then it doesn't obey the right line numbers... instead a whole file it could do. 😺
That also can be taken care of via:

Code: Select all

[code=lang line_num=yes line_start=5]...[//code]
if line_start={any_int} is found as attribute of [code]...[/code] then add HTML attribute data-start="{any_int}" to it.
check : https://prismjs.com/plugins/line-numbers/

we can also combine both as:

Code: Select all

[code=lang line_num={any_int}]...[//code]
Best regards :+1:
Dark❶ [dark1]
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: [3.3][BETA] Prism JS syntax highlighter ⚡️

Post by 3Di »

Yes, I know how it should work, in fact I 've included it into the JS for future implementation, if any.
Just I am not sure I want to include it ATM, see: viewtopic.php?p=15535856#p15535856
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: [3.3][RC] Prism JS syntax highlighter ⚡️

Post by 3Di »

New version RC 1.0.0 released, see first post for download link.
v1.0.0-RC on 10-May-2021
- Cumulative fixes
- Update library and themes to PrismJS 1.23.0
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
alphasnd
Registered User
Posts: 3
Joined: Tue May 18, 2021 2:29 pm

Re: [3.3][BETA] Prism JS syntax highlighter ⚡️

Post by alphasnd »

Hello !

I just tried your plugin and it works very well. I run a programming forum, and I would like to know if it's possible to define a default language for the 'code' block (ie: without specifying =language). So all current code block will be automatically highlited.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: [3.3][BETA] Prism JS syntax highlighter ⚡️

Post by 3Di »

I'm not sure I get the point, sorry.
Can you expand on that?
Would you like to have a BBcode that can highlight a specific code language in an easy way?
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: [3.3][BETA] Prism JS syntax highlighter ⚡️

Post by 3Di »

For all those who want to have one or more individual bbcodes highlighting a specific code language, here is an example.

The BBcode CODE remains unchanged but you can add as many as you like. :P

https://phpbbstudio.com/viewtopic.php?p=2920#p2920
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
alphasnd
Registered User
Posts: 3
Joined: Tue May 18, 2021 2:29 pm

Re: [3.3][BETA] Prism JS syntax highlighter ⚡️

Post by alphasnd »

For example this page: https://www.purebasic.fr/english/viewto ... 13&t=43219

As you can see, posters only used a [ code ] block and I would like to apply automatically the PureBasic syntax highlighter instead of default plain text if no language is specified, as the whole forum is about PureBasic (and code posted only in PureBasic).
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: [3.3][BETA] Prism JS syntax highlighter ⚡️

Post by 3Di »

alphasnd wrote: Tue May 18, 2021 3:32 pm As you can see, posters only used a [ code ] block and I would like to apply automatically the PureBasic syntax highlighter instead of default plain text if no language is specified, as the whole forum is about PureBasic (and code posted only in PureBasic).
Nope. That's beyond the scope of this extension and the library itself.

See above post of mine for a custom BBcode CODE like

HTML replacement

Code: Select all

<div class="codebox"><p>{L_CODE}{L_COLON} <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></p><pre class=" language-purebasic"><code class=" language-c">{TEXT}</code></pre></div>
Not tested but should work.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: [3.3][BETA] Prism JS syntax highlighter ⚡️

Post by 3Di »

Sorry, on the fly... :ugeek:

Code: Select all

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

🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
alphasnd
Registered User
Posts: 3
Joined: Tue May 18, 2021 2:29 pm

Re: [3.3][BETA] Prism JS syntax highlighter ⚡️

Post by alphasnd »

Thank you, I successfully created a new [ code-pb] with the HTML you provided and it works. I tried to overide the [ code ] BBCode but it tells me it already exists (obviously) so I guess it's not possible. Do you know if you could add a per user theme config for your extension (so every user could choose its own theme) ?
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: [3.3][BETA] Prism JS syntax highlighter ⚡️

Post by 3Di »

alphasnd wrote: Wed May 19, 2021 7:40 am Do you know if you could add a per user theme config
I could but I don't want to. My task here ends.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
Locked

Return to “Abandoned Extensions”