Page 1 of 1

'inline code tag' (just using courier font or something)

Posted: Mon Oct 17, 2011 11:11 am
by Apollo
Instead of using [code] or [syntax=somelanguage] to include a block of code, it can be very convenient to just include a small piece of code (a single statement or something) 'inline', i.e. in the middle of your text.

No fancy markup required, to distinguish code from regular text it'd be enough if we could just use a courier new font or something. So you can include something Image within a sentence.

(done with an image here to show what I mean, you get the idea)

Re: 'inline code tag' (just using courier font or something)

Posted: Mon Oct 17, 2011 3:36 pm
by twinedev
I agree, i end up just using bold to make it stand out, but displaying it as a fixed font would be nicer (especially when it comes to a bit that has a double and a single quote next to each other.)

Re: 'inline code tag' (just using courier font or something)

Posted: Mon Oct 17, 2011 4:46 pm
by pickle
This should be relatively simple to do with a [c][/c] shortcode.

[Edit] [c] has been added. It wraps the text in <code> tags

Re: 'inline code tag' (just using courier font or something)

Posted: Mon Oct 17, 2011 5:21 pm
by twinedev
So this will be a code (testing it on the quick reply area)...[c]$bNiceJob = ($this->works && $im->happy);[/c]

Sweet thanks.

Re: 'inline code tag' (just using courier font or something)

Posted: Tue Oct 18, 2011 10:09 am
by social_experiment
What a coincidence, just a few minutes ago i made a post and wondered if the c behind Font colour was there because the page didn't finish loading but now i know :) I agree about its use, sometimes a block of code is just too heavy for a single line within a reply.

Re: 'inline code tag' (just using courier font or something)

Posted: Tue Oct 18, 2011 4:22 pm
by pickle
I've updated the tag to [inline] as it was getting mixed up with the syntax highlighting plugin. It appears to still be broken if you surround a function name, or more specifically "()" in the tags - so let's consider this a "beta" feature for know.

Re: 'inline code tag' (just using courier font or something)

Posted: Fri Oct 21, 2011 4:43 am
by Apollo
Thanks, although it seems to mess up with pretty much any non-alphabetic character between the tags (e.g. this works vs [inline]this doesn't[/inline] because of the single quote). Perhaps some bbcode regexp is a bit too restricted currently? Same happens with : ; " # $ etc, so that makes it kinda useless for any actual code.

I noticed currently the &#91;inline] tag evaluates to <code class="inline">, maybe it could just use <span class="inline"> for the time being, and later on back to <code> once it doesnt interfere with the syntax highlighting anymore? (I'd rather have non-syntax-highlighted inline code than not-working-at-all :)).

One more request: maybe to make the code stand out a bit more, make the background a bit brighter? Currently, the background color appears to be alternating #e1ebf2 and #ecf3f7, perhaps make the .inline css have background-color:#ffffff for example? (or .inlinecode if .inline is also used for other stuff)

Re: 'inline code tag' (just using courier font or something)

Posted: Mon Oct 24, 2011 11:16 am
by pickle
I've done no CSS modification for this, so there is certainly room for improvement. Maybe we'll have to find a plugin to do this, or modify the syntax plugin to allow for inline code, as evidently the quick-n-dirty BBCode solution isn't working as we wanted.