Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
syntax highlighting
#11
Quote:Im wondering if we might be running an older version that does not have these issues fixed.

maybe if we compare and contrast the plugin code between the latest github code, these issues might of been resolved.
Yes running an older version,the problem is that there no info about SyntaxHighlighter v4 and MyBB.
V4 use different tool to build npm.
You can ask MyBB staff about this.

Quote:based on this issue
https://github.com/syntaxhighlighter/syn...issues/366

it looks like the devs expect you to escape the HTML
Yes,but now i was trying to fix error @ichabod801 post about.
[shcode=python]print('Hello world')[/shcode]

I will try later to run XRegExp.js together with the fix i have applid to uncompressed shCore.js.
Reply
#12
Quote:You can ask MyBB staff about this.
I did when you first notified me of the problem. They just referred me to the mods, which in turn referred me to that github. Which the only contact there is the issues. In which i did.
Recommended Tutorials:
Reply
#13
(Sep-15-2016, 06:44 PM)metulburr Wrote:
Quote:You can ask MyBB staff about this.
I did when you first notified me of the problem. They just referred me to the mods, which in turn referred me to that github. Which the only contact there is the issues. In which i did.
Just to make it clear i am now not talking about what i first post about.
That is fixable or to be ignored.
The error @ichabod801 posted has to fixed or we have to drop shcode.
It is a mess as it is now,eg here is hard to clean up code.
[shcode=python]<img class='image' src="{{ url_for('static', filename='images/{}'.format(pic)) }}"></img>[/shcode]

As i mention i shall look into more into it when i have time.
If you can ask MyBB about SyntaxHighlighter v4 or this specific problem.
Reply
#14
So been messing around a lot with this(a mess of .bak files :blush: ),not solved yet.
The bug has been reported here.
So the error has been fixed in V4.

i wanted to test this to be sure.
So here i have build V4 and run it in Flask.
[Image: PDZEto.jpg]
So it work an can choose theme color.

After build process there are only 2 files "syntaxhighlighter.js" and "theme.css".
Set links in header call it with(eg in post or make a button):
[shcode=python]
<pre class="brush: python">
    #python code
</pre>
[/shcode]
So it should be possible to do this in MyBB,
shall look into it.
Still new to MyBB,so if someone have idea how implement this post it here.
Reply
#15
I am having trouble determining what you mean? So you only need a custom BBCode to link to a pre tag with the the python brush class?
Quote:
<pre class="brush: python">
    #python code
</pre>

Did you update the server files of V4?
Recommended Tutorials:
Reply
#16
Quote:So you only need a custom BBCode to link to a pre tag with the the python brush class?
Make button simelar(or replace) to shcode button that generate this.
[shcode=python]<pre class="brush: python">
   #Your Python code here
</pre>[/shcode]

Quote:Did you update the server files of V4?
No i just build V4,and have testet it local with Flask.
V4 is really compact after build as i mention only 2 files.

In head i call it like this.
[shcode=python]<link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/theme.css') }}" />
<script src="{{ url_for('static', filename='js/syntaxhighlighter.js') }}"></script>[/shcode]
These find files i have in server folder of Flask.
In <body> i call it as show first,so it's a lot cleaner approach than old version.
So i shall test it on server later,
a little feed up now after a long session to try to fix the old version :-/
Reply
#17
Theme test.
[Image: rFwqhi.jpg]
[Image: MXQfwa.jpg]
[Image: bmkiED.jpg]
[Image: J28G53.jpg]
[Image: kliSdW.jpg]
Reply
#18
Quote:Make button simelar(or replace) to shcode button that generate this.
I didnt do anything other than install the plugin

create a BBCode in editor
ACP -> Plugin settings -> My Insert Buttons -> add the tag
the image is defaulted to youtube, but is linked via the same name as the tag.
The image directory for them is 
/var/www/python-forum.io/jscripts/sceditor/myinsertbuttons
and they must be 16px by 16px with a png extension. So my image for shcode tag is shcode.png in there. 

And then to link the BBCode tag with the html (i think, not sure) is 
ACP -> Configuration -> MyCode 

Another option is to compare and contrast the plugin i added for the spoiler BBCode (in which does not have a button). This plugin is just this one file and converts BBCodes to the spoiler tag. But this requires php knowledge. 
/var/www/python-forum.io/inc/plugins/hazSpoiler.php
Recommended Tutorials:
Reply
#19
Test of V4,have got it to work but struggle with "br" tag :s
MyBB seems to auto generate on new line.
Had to enable html in post for now to run it.
Have deactivated V3 to avoid conflict.
<pre class="brush: python">
print('hello world')

print("Foo")  
</pre>

<pre class="brush: python">
print('hello world')

print("Foo")  
</pre>
Reply
#20
Thats cool.
If we could fix the break tag, and get html code to link to a BBCode it would be a nice addition.
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Undo (Ctrl+z) doesn't work on highlighting CynthiaMoore 8 8,293 Apr-25-2020, 05:00 AM
Last Post: buran
  feature request: highlighting Skaperen 9 6,419 Jan-26-2017, 04:13 PM
Last Post: Kebap

Forum Jump:

User Panel Messages

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