Jump to content


Photo

[forum] Inline Code


  • Please log in to reply
10 replies to this topic

#1 Frankie

Frankie
  • Members
  • 2930 posts

Posted 10 April 2012 - 02:02 AM

Could we have inline code highlighting? Not syntax highlighting, or anything like that.

Here's a demo.



I like backticks, because that's what I'm used to with MarkDown. Something like some code would also work nicely. I know phpBBv3 has a setting for custom tags. You could just have it wrap it in <span class="inlinecode">$1</span>.

P.s. I just threw the style together quickly. It can be used under the terms (or lack there of) of the WTFPL.

#2 polyethene

polyethene

    Administrator

  • Administrators
  • 5473 posts

Posted 10 April 2012 - 09:25 AM

Great idea, inline code is now supported.

#3 TheStumps

TheStumps
  • Members
  • 141 posts

Posted 24 April 2012 - 11:17 PM

Perhaps I am not doing something correctly, but the inline code does not seem to preserve indentation like the regular code tag does.

It also only colors the code all one color (which is alright), rather than being smart (like the old code tag was) and coloring comments differently than script syntaxes.

#4 guest3456

guest3456
  • Members
  • 1324 posts

Posted 11 May 2012 - 03:46 PM

i think the inline code style should have a different background to stand out from normal text, ala stackoverflow. right now it just looks like the font color is changed to blue and the font style is changed.

#5 infogulch

infogulch
  • Moderators
  • 717 posts

Posted 11 May 2012 - 04:50 PM

TheStumps: the term "inline code" implies that indentation is irrelevant since it only supports one line of code. If you want multiple lines of code (with indentation), then use normal code tags.

I agree that inline code should have more defined boundaries/background.

#6 engunneer

engunneer
  • Fellows
  • 9162 posts

Posted 11 May 2012 - 06:41 PM

+1 on background color

#7 otoh

otoh
  • Guests

Posted 12 May 2012 - 01:48 AM

the term "inline code" implies that indentation is irrelevant since it only supports one line of code.

On the other hand, spaces can be significant in code, even inline. For example x := " " assigns two spaces... or does it?

#8 sumon

sumon
  • Moderators
  • 1307 posts

Posted 12 May 2012 - 09:13 AM

i think the inline code style should have a different background to stand out from normal text, ala stackoverflow. right now it just looks like the font color is changed to blue and the font style is changed.


the term "inline code" implies that indentation is irrelevant since it only supports one line of code.

On the other hand, spaces can be significant in code, even inline. For example x := " " assigns two spaces... or does it?


I personally think it's fine as it is now, it's just for quick MsgBox Messages code snippets anyway. It's much more convenient for giving code examples (such as x := "text") than having to use a default code block - but any "real" code should take place in a code block. jm2ยข

#9 polyethene

polyethene

    Administrator

  • Administrators
  • 5473 posts

Posted 12 May 2012 - 09:29 AM

I've applied the changes as suggested.

#10 JSLover

JSLover
  • Members
  • 920 posts

Posted 12 May 2012 - 09:38 AM

I've applied the changes as suggested.

...that's better, but can you also add white-space: pre to the style?

That would solve...

For example x := " " assigns two spaces... or does it?

Example...

how many spaces?
how many spaces?
Update: The above Suggestion was resolved (although without a reply mentioning it)...but how about the following suggestion?...

...& perhaps add left & right border?
...that means: add left & right border to inline code...it has a nice top & bottom border, I think the same slight left & right border would look good.

Also, can you move the <C> button next to the <Code> button & perhaps rename it to <Inline Code>?

& if you do move that button, how about moving the <S> button too? -- Put "S" next to B I U

To be completely clear, instead of the current button order (& naming/casing)...

<B> <i> <u> <Quote> <Code> <List> <List=> <*> <Img> <URL>
<c> <gist> <s> <youtube>

...I'm suggesting this...

<B> <I> <U> <S> <Quote> <Code> <Inline Code> <gist> <List> <List=> <*> <Img> <URL>
<YouTube>

...wrapping the buttons wherever necessary, for example...

<B> <I> <U> <S> <Quote> <Code> <Inline Code> <gist>
<List> <List=> <*> <Img> <URL> <YouTube>

Summary of changes...

[*:15uwkiei]Uppercase <I> <U> <S>
[*:15uwkiei]Rename <c> to <Inline Code>
[*:15uwkiei]Rename <youtube> to <YouTube>
[*:15uwkiei]Move <S> next to <B> <I> <U>
[*:15uwkiei]Move <Inline Code> next to <Code>
[*:15uwkiei]Move <gist> next to <Inline Code>
...in this case, I moved <gist> up next to the other "code" buttons (which I hadn't suggested before).

#11 Frankie

Frankie
  • Members
  • 2930 posts

Posted 16 May 2012 - 02:43 PM

@JSLover, I'm not sure but I think it would be difficult because of how phpBB is set up. Custom codes are naturally just appended to the built-in ones.