Syntax highlighting

https://www.phpbb.com/ideas/
Post Reply
User avatar
Meis2M
Translator
Posts: 1009
Joined: Wed Mar 03, 2010 11:32 am
Location: IR.Damghan
Name: میثم نوبری
Contact:

Syntax highlighting

Post by Meis2M »

Idea Name:
Syntax highlighting

Description:
Syntax highlighting is a feature of text editors that are used for programming, scripting, or markup languages, such as HTML. The feature displays text, especially source code, in different colours and fonts according to the category of terms.


Screenshot concept:
Image
phpBB persian international support
Follow us in Instagram
Free upgrade and install extensions on your forum - drop me PM
Ultimate phpBB SEO Friendly URL extension
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26455
Joined: Fri Aug 29, 2008 9:49 am

Re: Syntax highlighting

Post by Mick »

Where would you like this, phpBB doesn’t include a text editor?
  • "The more connected we get the more alone we become" - Kyle Broflovski©
  • "The good news is hell is just the product of a morbid human imagination.
    The bad news is, whatever humans can imagine, they can usually create.
    " - Harmony Cobel
User avatar
Meis2M
Translator
Posts: 1009
Joined: Wed Mar 03, 2010 11:32 am
Location: IR.Damghan
Name: میثم نوبری
Contact:

Re: Syntax highlighting

Post by Meis2M »

Mick wrote: Tue Aug 31, 2021 8:53 am Where would you like this, phpBB doesn’t include a text editor?
my point is Syntax highlighting in code bbcode

Code: Select all

test
only.
phpBB persian international support
Follow us in Instagram
Free upgrade and install extensions on your forum - drop me PM
Ultimate phpBB SEO Friendly URL extension
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Syntax highlighting

Post by david63 »

Already there in the code bbcode

Code: Select all

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
User avatar
Meis2M
Translator
Posts: 1009
Joined: Wed Mar 03, 2010 11:32 am
Location: IR.Damghan
Name: میثم نوبری
Contact:

Re: Syntax highlighting

Post by Meis2M »

html codes

Code: Select all

 <!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html> 
phpBB persian international support
Follow us in Instagram
Free upgrade and install extensions on your forum - drop me PM
Ultimate phpBB SEO Friendly URL extension
User avatar
Meis2M
Translator
Posts: 1009
Joined: Wed Mar 03, 2010 11:32 am
Location: IR.Damghan
Name: میثم نوبری
Contact:

Re: Syntax highlighting

Post by Meis2M »

and i think it could be good if can adding line number too

i found css formula for adding line number:
https://stackoverflow.com/questions/439 ... s-with-css
phpBB persian international support
Follow us in Instagram
Free upgrade and install extensions on your forum - drop me PM
Ultimate phpBB SEO Friendly URL extension
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26455
Joined: Fri Aug 29, 2008 9:49 am

Re: Syntax highlighting

Post by Mick »

I seem to remember there was syntax highlighting as you describe it in the BBCode code box at one time but it was removed for some reason or other. I may have dreamt it though.

I should have written ‘code editor’ or ‘plain text editor’ above🤨
  • "The more connected we get the more alone we become" - Kyle Broflovski©
  • "The good news is hell is just the product of a morbid human imagination.
    The bad news is, whatever humans can imagine, they can usually create.
    " - Harmony Cobel
rxu
Extensions Development Team
Posts: 3711
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Contact:

Re: Syntax highlighting

Post by rxu »

It is already implemented with s9e textformatter.
Use code bbCode like [code lang=html]some html code here[/code] and you'll get it. Example:

Code: Select all

<!-- INCLUDE overall_header.html -->

<p class="{S_CONTENT_FLOW_END} responsive-center time<!-- IF S_USER_LOGGED_IN --> rightside<!-- ENDIF -->"><!-- IF S_USER_LOGGED_IN -->{LAST_VISIT_DATE}<!-- ELSE -->{CURRENT_TIME}<!-- ENDIF --></p>
<!-- IF S_USER_LOGGED_IN --><p class="responsive-center time">{CURRENT_TIME}</p><!-- ENDIF -->
The list of supported languages should be this https://github.com/highlightjs/highligh ... -languages
User avatar
Meis2M
Translator
Posts: 1009
Joined: Wed Mar 03, 2010 11:32 am
Location: IR.Damghan
Name: میثم نوبری
Contact:

Re: Syntax highlighting

Post by Meis2M »

so it is great , we need adding line number too
phpBB persian international support
Follow us in Instagram
Free upgrade and install extensions on your forum - drop me PM
Ultimate phpBB SEO Friendly URL extension
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Syntax highlighting

Post by david63 »

Meis2M wrote: Tue Aug 31, 2021 2:42 pm so it is great , we need adding line number too
Why "we" - I don't need them!

If I post a block of code which line numbers should be shown - the line numbers in the code block or the line numbers from the original code?
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
User avatar
warmweer
Jr. Extension Validator
Posts: 11194
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Re: Syntax highlighting

Post by warmweer »

*removed* as my input amounted to what david63 already wrote what I thought (but in a much shorter way ;-) ).
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
rxu
Extensions Development Team
Posts: 3711
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Contact:

Re: Syntax highlighting

Post by rxu »

Fail, didn't work on default 3.3.4 for me. It seems that .com has some extension installed, but anyway this functionality is a matter of simply adding an extension if not in the core.

P.S. I guess the extension is this https://github.com/s9e/phpbb-ext-highlighter
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: Syntax highlighting

Post by 3Di »

Meis2M wrote: Tue Aug 31, 2021 8:33 am The feature displays text, especially source code, in different colours and fonts according to the category of terms.
That's exactly what this extension does: viewtopic.php?t=2557806
Plus has a bunch of styles to chose from in ACP. Tested on phpBB 4 as well.

Usage
[code=php][/code]

[code=twig][/code]

[code=css][/code]
🆓 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
Kailey
Community Team Leader
Community Team Leader
Posts: 3726
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay
Contact:

Re: Syntax highlighting

Post by Kailey »

david63 wrote: Tue Aug 31, 2021 2:47 pm
Meis2M wrote: Tue Aug 31, 2021 2:42 pm so it is great , we need adding line number too
Why "we" - I don't need them!
Agreed. Better as an extension, like the one 3Di or rxu mentioned.
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules

If you have any questions about the rules/customs of this website, feel free to send me a PM.
Post Reply

Return to “phpBB Ideas”