09 December 2013, 16:08 | #1 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
BBCode formatting for code
I'm wondering if it's possible to add/enable one of those convenient BBCode extensions that allow you to insert highlighted and formatted code in the middle of a line of text, without all the line breaks that [CODE] gives.
Sort of like this: http://stackoverflow.com/questions/2...g-point-values |
09 December 2013, 17:06 | #2 |
Global Moderator
Join Date: Sep 2008
Location: Might as well be WORK :(
Age: 56
Posts: 4,110
|
yup, all RCK needs to do is to add a new user defined BBCode like the following
New tag = [hl] (short for highlight) <span style="background-color: yellow;">{param}</span> (yellow being the highlight colour, this can be changed of course) And that's it And add a custom button image to use |
09 December 2013, 17:19 | #4 | |
Administrator
Join Date: Feb 2001
Location: Paris / France
Age: 45
Posts: 3,084
|
Quote:
Leffmann: post one example of what you would like |
|
09 December 2013, 19:28 | #5 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Syntax highlighting is not necessary, just a fixed width font and a change of background color, so you can write a small bit of legible code in the middle of a sentence. Like [CODE], but inlined.
edit: the one on the right that reads "malloc" looks just right I think, same font and colors as [CODE] here on EAB. Last edited by Leffmann; 09 December 2013 at 20:01. |
09 December 2013, 21:04 | #6 |
Global Moderator
Join Date: Sep 2008
Location: Might as well be WORK :(
Age: 56
Posts: 4,110
|
<font face="courier new"><span style="background-color:#e7e8f5; color:black">{param}</span></font>
That above code will use the 'Courier New' fixed width font (the same font used in EAB's [CODE] tag), give it the background colour the same as your 3rd image, and keep the font colour black. Is that what you're asking Leffmann? And just to clarify, what you're wanting isn't to be included within [CODE] tags as RCK mentioned earlier? Last edited by DH; 09 December 2013 at 22:09. Reason: Updated example image |
09 December 2013, 21:45 | #7 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
Cool
How about Lucida Console: move.l d0,(a0)+ Seems nice. |
09 December 2013, 23:04 | #8 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Yes exactly as you've done there, DH, for use in the middle of a regular sentence, outside of [CODE]. Important is also that it must stop parsing just like [CODE], so it doesn't consolidate spaces and replace text with smilie-icons.
I like the font and colors that [CODE] uses, it just makes all the code snippets look more consistent. |
10 December 2013, 01:30 | #9 |
Global Moderator
Join Date: Sep 2008
Location: Might as well be WORK :(
Age: 56
Posts: 4,110
|
I have a feeling this is going to be rather more difficult than I first thought.
What you're wanting is a bbcode that will [noparse] the given text that is to be highlighted (We'll call it that for now), but I already know it can't do that without the [noparse] destroying the highlighting bbcode at the same time, because the very text you're wanting to highlight is the very same text you are wanting to strip with [noparse] The three tags that could be used are <pre> <xmp> <textarea>, but unfortunately, none of them work and none of them keep the highlight, despite the [noparse] tags being place inside the highlight code. I'm not an html expert, so if anyone else knows of a way around, feel free to jump in For me it's a kinda catch 22 situation, unless RCK can come up with some kind of script that will perform the noparsing but keep the highlight, then I have really no idea. |
10 December 2013, 05:54 | #10 |
Rumpig
Join Date: Aug 2006
Location: The bottom of the bottle
Age: 92
Posts: 243
|
VB custom bbcode construction includes a 'Disable Smilies Within This BB Code' checkbox.
I just did a test using the html you posted above DH and here is the result: |
10 December 2013, 16:11 | #11 |
Global Moderator
Join Date: Sep 2008
Location: Might as well be WORK :(
Age: 56
Posts: 4,110
|
Haps, does that still consolidate spaces?
EDIT: nm, I have just checked and no it doesn't unfortunately Last edited by DH; 10 December 2013 at 16:26. |
10 December 2013, 16:32 | #12 |
Rumpig
Join Date: Aug 2006
Location: The bottom of the bottle
Age: 92
Posts: 243
|
Not an addon. 'VB custom bbcode construction' was obviously a poor choice of words (sounded good to drunken me at the time), I was just using the 'Add New BBCode' option.
My testing was done on VB4.2.2, and whatever I put between those custom tags came out exactly as I wrote it, could be it is not the same with this version. |
10 December 2013, 16:34 | #13 |
Global Moderator
Join Date: Sep 2008
Location: Might as well be WORK :(
Age: 56
Posts: 4,110
|
I have sorted it
Do as you suggested and Disable smilies within the bbcode and use this code in replacement \o/ <pre style="display: inline; background-color:#e7e8f5; color:black">{param}</pre> EDIT: Now it's up to RCK to decide if he'll add it Example below:- EDIT2: Excuse the colours I used, as it's been done on our vBulletin site using our default colour scheme EDIT3: @haps, my testing was done in vB4.2.1 and I wouldn't expect there to be any difference between vB versions as it's using standard html code Anyway, if it wasn't for you mentioning the smilies could be disabled, I may not have pursued it and eventually figuring it out So hats off to you haps for making me succeed Last edited by DH; 10 December 2013 at 22:19. |
11 December 2013, 13:05 | #14 |
Administrator
Join Date: Feb 2001
Location: Paris / France
Age: 45
Posts: 3,084
|
let's test "code2" in a
demo with [ WhiteSpace]sentence. versus "code" in Code:
demo with [ WhiteSpace] It seems OK Thanks to DH for all testing and compilation of html info |
11 December 2013, 14:23 | #15 |
Global Moderator
Join Date: Sep 2008
Location: Might as well be WORK :(
Age: 56
Posts: 4,110
|
Thanks RCK
All of this is continuing to help me learn a little more of html code, just glad to have helped, albeit in a very small way |
11 December 2013, 15:59 | #16 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Yep that's perfect! Thanks a lot, all of you.
|
12 December 2013, 21:28 | #17 |
Global Moderator
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,300
|
Yes, that's a useful feature for highlighting small code excerpts. Thanks RCK and DH!
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Formatting Of Code For XAMOS | fishyfish | support.Apps | 1 | 29 July 2013 18:15 |
Formatting a disc | chris_newton | support.WinUAE | 4 | 07 October 2009 22:02 |
help before formatting | fc.studio | support.Apps | 3 | 25 December 2007 00:21 |
Formatting my HD ? | blade002 | support.Apps | 5 | 21 September 2007 22:19 |
3D code and/or internet code for Blitz Basic 2.1 | EdzUp | Retrogaming General Discussion | 0 | 10 February 2002 11:40 |
|
|