Feature #1301

The code tag needs improving

Added by kju about 6 years ago. Updated about 5 years ago.

Status:Expired Start date:05/09/2009
Priority:High Due date:
Assignee:- % Done:

0%

Category:Website
Target version:-
Close Reason: NGUrl:
BIForumURL: WIKIurl:

Description

The code tag needs improving. Example:

The code tag needs improving. Example

vs quote

The code tag needs improving. Example

vs pre

The code tag needs improving. Example

History

Updated by Sickboy about 6 years ago

  • Assignee changed from Sickboy to kju

kju wrote:

The code tag needs improving. Example:

The code tag needs improving. Example

If you want to display code like pre, you use pre. Highlighted classes of code are inside pre anyway.
No idea whats wrong with it or what you want :)

Updated by kju about 6 years ago

  • Assignee changed from kju to Sickboy

No.

Pre, code and comment have different logic and are meant to
be used for different things.

It is about visual presentation:

Pre creates
  • Border
  • Background
  • Indentation

Good.

Quote creates
  • Indentation
  • Leading |
  • Text italic

Good.

Code creates
  • Only smaller font size

BAD!

It needs better visualization. I suggest:
  • Border
  • Different background color.

Updated by kju almost 6 years ago

  • Target version set to 152

Updated by Sickboy almost 6 years ago

  • Assignee changed from Sickboy to Squelch

Updated by Spooner almost 6 years ago

No, the code tag creates same point-size (to my eye), but fixed-width rather than proportional font. This happens to appear slightly smaller to the eye, but it is a standard way to display the different fonts.

The code tag gives the same formatting as the at-symbol, but also allows specific script highlighting. If you think of HTML, code is an in-line format (span) and pre is a block format (div). Thus, we use pre + code tags to get highlighting in a block.

Updated by kju almost 6 years ago

Sorry I dont get at all Spooner what you are expressing here?!

@ == code tag.

So for you the visual code tag formatting is fine, Spooner?
Like this one?

config = true;

Updated by Spooner almost 6 years ago

is the _simple_ code tag, since it only gives you fixed-spaced font, but it is easy to type. The actual _code_ tag, if given a class, gives you code highlighting. Without a class specified it is the same as .

Both are in-line elements, so it is inappropriate to use them in a block context. That is why you need to put them in a pre tag to get what you would call a code block.

Updated by kju almost 6 years ago

Hm I am not saying I want the simple @ to be a code block.
Where do you read this?

Quote from above

Code creates

  • Only smaller font size

BAD!
It needs better visualization. I suggest:

  • Border
  • Different background color.

Updated by Sickboy almost 6 years ago

Even though making tough sense, i'm with Spooner :)

Updated by kju almost 6 years ago

  • Status changed from Assigned to Feedback
  • Assignee changed from Squelch to Spooner

So you say the current @ code tag is visual good/fine, right?

Updated by Sickboy almost 6 years ago

kju wrote:

So you say the current @ code tag is visual good/fine, right?

Yea. If I want to focus it, I will put pre around :)

Updated by kju almost 6 years ago

Pre disables inline, does it not?

This limits the use of @ with better formatting by use pre pretty much.

Updated by Spooner almost 6 years ago

Both @ and code tag are working as they are intended to. If we change them to encompass more things, things we can easily add by nesting in pre tag, then they become less versatile. Thus, leave everything as it is!

Updated by kju almost 6 years ago

How does a different background colors to a sole @-block make it less versatile?

This is an example code: myCode = "bleh";

This is a list:

  • Code example two: exit;
  • Trying pre inside a list:
    does this work?
  • Sqf code block:
    1 sqf = true;

Or as part of a line:

hm?

Sqf code block:
1 sqf = true;

So please tell me how to achieve the inline/same line code thing with pre
and please explain me the sole @ block has good formating?

Updated by Spooner almost 6 years ago

  • inline unhighlighted with at-symbol (C button): frog = 12;
  • inline unhighlighted with unclassed code tag: frog = 12;
  • inline highlighted with sqf code tag: 1 frog = 12;
  • block unhighlighted with pre tag (PRE button):
frog = 12;
  • block highlighted with pre + sqf code tag (unlabelled SQF button):
1 frog = 12;

I actually suggest that the unlabelled SQF button become an inline button (like bold text) and just add code tag, not pre as well.

The problem apparent here is that CodeRay highlighting is adding line numbers for inline highlighted code, which is something I will look at once I get onto CodeRay again (which is an issue with how Coderay is called from RM rather than Coderay itself).

Updated by kju almost 6 years ago

I agree to most part of your post Spooner.

Still we only have SQF SHL and not for everything else.

@ IMO alone itself is pretty useless as it makes the text
even more unreadable then without.

So all I am saying is that code block should have a white
background color or something else to make it apparent.
Personally I would vote to disable the font/size change too.
It makes it harder to read and a different system (see above)
should be used to indicate the
code block.

(aka SHL as we have for SQF or block display via pre)

Updated by Spooner almost 6 years ago

Well, I agree that it is messy having pre + code and all that, but the alternative I'm working on is: code tag which is inline (that is, no newlines inside the tag) is inline with the text around it and one that is multi-line (that is, with at least one newline inside the tag) is drawn with line-numbers in a block, without need for a specific pre block around it. This will make existing pre+code blocks look a bit messed up, but they will be readable and can easily be manually cleaned up.

Writing code in a fixed-width font, is the universal standard for how to indicate code. If it is in a block, then a background is appropriate. Perhaps increasing the font-size of inline code, so it appears to be the same size as the surrounding code might help readability (if a proportional font is 12pt, then a 14 or 15pt fixed-width font will appear to have the same height, but will be wider). Yeah, well, I'll try to sort that out tomorrow.

Updated by kju almost 6 years ago

Cheers!

Updated by kju almost 6 years ago

  • Status changed from Feedback to Resolved
1 sqf = true; 1 ammo = 1;

code

Updated by kju almost 6 years ago

  • Status changed from Resolved to Assigned

Hm can we please have more visible background color. ;(

Updated by Spooner almost 6 years ago

Actually, I'm completely behind the idea of removing the background colour entirely, since it doesn't make sense in-line code and looks pretty ugly to me (solid or semi-transparent). I corrected the font-size so the code text wasn't tiny compared to the regular text, so issues with difficulty reading it should no longer be relevant. What about other people?

Updated by kju almost 6 years ago

The font and size is great now. Yes.

Are you saying a code block should not be highlighted in any way?

.\arma2\path\to\file.ext

1 .\arma2\path\to\file.ext
.
.\arma2\path\to\file.ext

My say it should be visible that it is a code "area". You not?
How can i make it (more) visible right now?

Updated by Spooner almost 6 years ago

No, code should be highlighted, but a code segment within the normal text flow should not have the background that a code block should have:

Code block (should have highlighting, linking and background)

1 fish = 5; 2 player setPos [0, 0, 99];

Inline code (should have highlighting and linking but background is distracting):

You can set the player's position with 1 setPos or 1 setPosASL to prevent them from becoming Dutch!

Updated by kju almost 6 years ago

The prob is that this only works for SQF (and config code soon).
Not for windows path or any other non supported code.

Not saying it should be background color.
Feel free to suggest other, better means of highlighting.

Updated by Spooner almost 6 years ago

Well, if you use at-symbol or code tag (without specified class) to include code then you have non-highlighted in-line code.

If you use ANY of the supported classes in a code tag, then you get exactly the same as you get with SQF! The only difference that SQF has is automatic linking to biki.

Updated by kju almost 6 years ago

I see. What about setting SQF for default/none specified?

Updated by Spooner almost 6 years ago

The default is for all the languages that aren't defined. If sqf is default, then you can't put in arbitrary code (such as LISP or your .\arma2\path\to\file.ext, though a path is not code unless it is wrapped by quotes. It is a path and should just be italicised when it appears inline).

Updated by kju almost 6 years ago

Of course I can put anything in there.
As my point is to get it more readable.
If by some weird coloring, better than nothing. :)

Updated by Sickboy almost 6 years ago

  • Target version deleted (152)

Updated by kju about 5 years ago

  • Status changed from Assigned to Expired
  • Assignee deleted (Spooner)

Also available in: Atom PDF