ZHAOF17 / syntaxhighlighter

Automatically exported from code.google.com/p/syntaxhighlighter
GNU General Public License v3.0
0 stars 0 forks source link

control flags, whitespace   and dialog style #107

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I have a blog, and I was searching for a way to make my code look nicer and
cleaner. Thanks for SyntaxHighlighter, I'm playing with it for a few hours
right now, and I'm just coming over to make some suggestions. Hope you can
do sth with them, otherwise, just forget this comment! ;)

1) Make a flag to add some controls, and to let others out. Use the 2^n-row
for this flag:
- integer 0: no controls visible
- integer 1 (2^0): info-control visible
- integer 2 (2^1): view source-control visible
- integer 4 (2^2): print-control visible
- etcetera
(ever seen the error-handling in php, it works exactly like this!)
With this, if someone wants to use (for this example) only the
viewsource-control and print-control, but no info-control, he would give
the flag integer 6, which combines 2 and 4. You can add all the options
from all your different flags in there, if you want.
Another up on this solution would be that one don't have to set
showControls if one only want to change firstline. (I want to add
syntaxhighlighter to my blog, without making changes to the code, so I can
update it very quick, but without all the controls but the info-control.
You ain't making this easy for me ;) )

2) Every whitespace is replaced with  . Wouldn't it be better to only
replace a whitespace if there are multiple whitespaces? Or for that matter:
if you replace every whitespace, then really replace them all. In this
script only the whitespaces between span-tags are replaced, the others are
still there. It means that when my screen is not big enough, replaced code
will not break to a new line, while unmanaged normal text will.
A possible solution could be regular expressions, but for now, a faster
option would be replacing one line code by two others:
- Search for str = str.replace(/ /g, ' ');, and replace it with str =
str.replace(/  /g, '  ');str = str.replace(/  /g, '  '); (yeah,
twice, because triple whitespace would otherwise become   and double
whitespace, turning every uneven number of whitespaces into an uneven-1
number.)

3) When I open the dialogbox (info-control), it has no style if I use an
inline style (without <link>). Possible solution would be a
createElement('div'), float=right and display=none to display it in-page.

I like syntaxhighlighter a lot, and I'm changing it a little bit right now
to make it usable for blogger without using another host as blogger itself.
Hope you can do sth with these suggestions, keep up the good work (it sure
makes it easier for me, when I don't have to write all this code myself ;)),
greetings,
MetalArend.

Original issue reported on code.google.com by metalar...@gmail.com on 21 Sep 2008 at 9:52