prismjs is the current standard for highlighting
www.prismjs.com
https://github.com/PrismJS/prism
PHPBB3-13919 - Syntax highlighting in [code]
-
- Registered User
- Posts: 48
- Joined: Thu Dec 24, 2015 10:47 am
Re: PHPBB3-13919 - Syntax highlighting in [code]
So is it coming in for 3.3? I hope it is?
I tried to implement and currently using Pretty code by Google on my 3.1 test forum.. It sort of works but sort of doesn't. Having it in core would be great.
I tried to implement and currently using Pretty code by Google on my 3.1 test forum.. It sort of works but sort of doesn't. Having it in core would be great.
Re: PHPBB3-13919 - Syntax highlighting in [code]
not sure if u r referring to me or joshyphp, but as far as prismjs that depends on the new theme. It will probably not be a major thought until its finished, but it will integrate easily enough with some minor changes in the backend
Re: PHPBB3-13919 - Syntax highlighting in [code]
not sure how the ext works but as it is now with 3.2 it does not produce the code properly from the parsser in that when we useJoshyPHP wrote: Fri Jun 05, 2015 2:20 am 3.1 provides syntax highlighting for PHP (and only PHP) via highlight_string(), using the BBCode[code=php]
.
3.2 has no syntax highlighting in code blocks for any language. My recommendation is to use a JavaScript highlighter such as highlight.js or SyntaxHighlighter. My preference goes to highlight.js because it automatically detects the language of the source and it also requires one script tag to be installed. Both are available on various CDNs.
I don't know whether 3.2 should provide syntax highlighting at all. As far as I'm concerned, I wrote an extension for it to see how hard it would be to implement. All it takes is a script block in overall_footer to dynamically load highligher.js whererever needed. It costs 490 bytes per page. Unminified code here.
[code=xxx]
we do not get the expected result in the html which should beCode: Select all
<pre>
<code class="xxx">
</code>
</pre>
Re: PHPBB3-13919 - Syntax highlighting in [code]
The extension only loads highlight.js from a CDN without modifying any BBCodes. highlight.js does its own auto-detection, it doesn't require a language hint although I believe it uses it if present. Is there a reason you want to use the language as class name?
Re: PHPBB3-13919 - Syntax highlighting in [code]
I am not familiar with highlight.js , but we should be as agnostic as possible to whichever framework someone wants to use there are many and most require it. Also there are cases that could be made for code blocks that should be highlighted and others they should notJoshyPHP wrote: Sat Mar 04, 2017 7:56 pm The extension only loads highlight.js from a CDN without modifying any BBCodes. highlight.js does its own auto-detection, it doesn't require a language hint although I believe it uses it if present. Is there a reason you want to use the language as class name?
Re: PHPBB3-13919 - Syntax highlighting in [code]
Simple. With javaScript code prettifier:
http://devcodepro.com/view/34/6/Syntax- ... phpBB-3.2-
http://devcodepro.com/view/34/6/Syntax- ... phpBB-3.2-
- 3Di
- Registered User
- Posts: 951
- Joined: Tue Nov 01, 2005 9:50 pm
- Location: Milano 🇮🇹 Frankfurt 🇩🇪
- Contact:
Re: PHPBB3-13919 - Syntax highlighting in [code]
Which is dated 2006, something newer and similar I could look at? I mean, not already mentioned here.jesssy wrote: Thu Apr 20, 2017 11:01 am Simple. With javaScript code prettifier:
http://devcodepro.com/view/34/6/Syntax- ... phpBB-3.2-
🆓 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. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
- DavidIQ
- Customisations Team Leader
- Posts: 1904
- Joined: Thu Mar 02, 2006 4:29 pm
- Location: Earth
- Contact:
Re: PHPBB3-13919 - Syntax highlighting in [code]
Ummm what?
https://github.com/google/code-prettify
Honestly don't know why this is even being brought up anyways since there is a semi-official extension for syntax highlighting already: https://github.com/s9e/phpbb-ext-highlighter
https://github.com/google/code-prettify
Honestly don't know why this is even being brought up anyways since there is a semi-official extension for syntax highlighting already: https://github.com/s9e/phpbb-ext-highlighter
- 3Di
- Registered User
- Posts: 951
- Joined: Tue Nov 01, 2005 9:50 pm
- Location: Milano 🇮🇹 Frankfurt 🇩🇪
- Contact:
Re: PHPBB3-13919 - Syntax highlighting in [code]
David, honestly I was looking at https://cdn.rawgit.com/google/code-pret ... rettify.js and I didn't see the 2013 on line 3 at the time I posted, my fault. The github link comes in handy, forked as well.
Well, I know the Joshyphp's extension already, but I am not completely satisfied of the results (not a Joshy's fault indeed).
Well, I know the Joshyphp's extension already, but I am not completely satisfied of the results (not a Joshy's fault indeed).
DavidIQ wrote: Sat Apr 22, 2017 3:15 am Honestly don't know why this is even being brought up anyways since there is a semi-official extension for syntax highlighting already:
That's why.. https://github.com/3D-I/code-prettify#h ... ed-as-codehanakin wrote: Sat Mar 04, 2017 11:50 pm there are cases that could be made for code blocks that should be highlighted and others they should not
🆓 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. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades