Python Forum
Syntax Highlighter Codebox Issues
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Syntax Highlighter Codebox Issues
#1
We are testing new code box. This python tag is syntaxhighlighter Version 4.x. which works with a number of langauges.

We converted all original code tags, php tags, etc. to this new python tag. Let us know if you see any problems. 

Current Issues with Syntax Highlighter Codebox:
  • No select all option (you can double click the code to select all)
  • no restriction on length down (For right now you can surround your python code tags with spoiler tags to shorten the code to a link to expand as needed)
  • copy and paste not working correctly (You must paste code as plain text for this codebox to work right CTRL + SHIFT + V or right click "paste as plain text")
  • Sometimes copying from HTML to codebox can add extra things (such as newlines, or switch a link to an <a> tag within the code box (images/links in the code box can break it and post the html instead)
  • hide underscores from within the code box, if it is at the bottom of the box, or a single line (this is only some browsers, and only on the bottom line of the code box)

import os

class Klass:
    '''docstring'''
    def __init__(self):
        self.var = "var"
        pass
Recommended Tutorials:
Reply
#2
Rows numeration :) Gooood
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
At the moment, when I use the python button to post this:

while True:
   number = int(input("enter a number between 1 and 10: "))    # Get a number
   if 0 <= number <= 10:
       print("number = ", number)
       # Go back and get another number
   else:
       print("out of range")
       break    # Break out of 'while' loop and continue with next command

print("Done")


i get this

[/font][/size][/color]
[color=#000000][size=small][font=InputMono][color=#000000][size=small][font=InputMono][color=#000080][b]while True[/b][/color]:
    number = [color=#000080]int[/color]([color=#000080]input[/color]([color=#008080][b]"enter a number between 1 and 10: "[/b][/color]))    [color=#808080][i]# Get a number
[/i][/color]    [color=#000080][b]if [/b][/color][color=#0000ff]0 [/color]<= number <= [color=#0000ff]10[/color]:
        [color=#000080]print[/color]([color=#008080][b]"number = "[/b][/color], number)
        [color=#808080][i]# Go back and get another number
[/i][/color]    [color=#000080][b]else[/b][/color]:
        [color=#000080]print[/color]([color=#008080][b]"out of range"[/b][/color])
        [color=#000080][b]break    [/b][/color][color=#808080][i]# Break out of 'while' loop and continue with next command
[/i][/color]
[color=#000080]print[/color]([color=#008080][b]"Done"[/b][/color])[/font][/size][/color][/font][/size][/color]
[color=#000000][size=small][font=InputMono]


In both Chrome and IE. Are you folks still working on this? 

If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#4
Where did you copy the code from? For example if you edit your post and select "source" bbcode option you see a ton of text modifcations.

this 
while True:
turns into this
Output:
[color=#000080][size=small][font=InputMono][b]while True[b][font][size][color][color=#000000][size=small][font=InputMono]:[font][size][color]
Recommended Tutorials:
Reply
#5
Quote:In both Chrome and IE. Are you folks still working on this?
It's a feature of MyBB to auto detect tag,so not sure if it's so easy fix.
Just copy from plain text editor and then post code.
There also a view source button far right in sceditor(ctrl+shif+s).

We are just happy to get syntaxhighlighter V4 to work.
I has been a little bumpy road,i have run V4 local and Flask all ok.
Then try to run it on server MyBB,but there where trouble with <br> tag.
metulburr did a really nice last fix,and the it all worked :)

So now we are running on Default theme which fit the forum fine.
There are also darker themes,but dos not fit forum so well.
Also Python inspired as Django theme.
[Image: rFwqhi.jpg]
Reply
#6
(Oct-04-2016, 04:09 PM)metulburr Wrote: Where did you copy the code from? For example if you edit your post and select "source" bbcode option you see a ton of text modifcations.

this 
while True:
turns into this
Output:
[color=#000080][size=small][font=InputMono][b]while True[b][font][size][color][color=#000000][size=small][font=InputMono]:[font][size][color]

Copied it from pycharm

Moved it to notepad++, lets see:

while True:
    number = int(input("enter a number between 1 and 10: "))    # Get a number
    if 0 <= number <= 10:
        print("number = ", number)
        # Go back and get another number
    else:
        print("out of range")
        break    # Break out of 'while' loop and continue with next command

print("Done")
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#7
@[snippsat]
Quote:Copied it from pycharm
apparently pycharm uses inherited BBCode to highlight their text, in which MyBB interprets back into the editor??
Recommended Tutorials:
Reply
#8
OK, a problem with pycharm? just mine? any other ide's have a problem?
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#9
Quote:a problem with pycharm?
apparently so

Quote: any other ide's have a problem?
I only use Vim and Geany, neither have this problem.
Recommended Tutorials:
Reply
#10
(Oct-04-2016, 04:31 PM)sparkz_alot Wrote: OK, a problem with pycharm?
No problem for me when i copy direct from PyCharm.
Have you copied code from net into PyCharm?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  codebox usage help doc metulburr 0 1,645 Oct-31-2020, 12:12 PM
Last Post: metulburr
  single/double quote escapes codebox highlighter metulburr 3 3,465 Aug-08-2017, 01:36 PM
Last Post: metulburr
  codebox borders metulburr 15 15,721 Nov-24-2016, 04:04 AM
Last Post: snippsat
  URL not showing properly in comments of codebox Larz60+ 4 5,467 Nov-05-2016, 04:23 PM
Last Post: Larz60+
  More codebox issues Mekire 26 19,432 Oct-13-2016, 05:20 PM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020