FlyerTalk Forums

FlyerTalk Forums (https://www.flyertalk.com/forum/index.php)
-   Technical Support and Feedback (https://www.flyertalk.com/forum/technical-support-feedback-386/)
-   -   whitespace inside CODE tag is not preserved (https://www.flyertalk.com/forum/technical-support-feedback/2030936-whitespace-inside-code-tag-not-preserved.html)

Zorak Dec 21, 2020 7:40 pm

whitespace inside CODE tag is not preserved
 
The CODE tag is supposed to be rendered in a monospace font and keep all whitespace intact, intended for use when showing programming source where indentation makes things easier to read (and in a language like Python is actually semantically important), and still useful on non-programming sites like FlyerTalk for showing data in tabular form, maybe with columns of words/numbers aligned, for example:

Code:

this          this
column      column
is              is
left          right
justified justified

but if you create a post with aligned text in a CODE block, then you edit the post, then whitespace is deleted and it ends up looking like this:

Code:

this this
column column
is is
left right
justified justified

(this can also be reproduced even without editing an existing post -- start a new post, click "Source" to switch from the WYSIWIG editor into the raw source editor mode, carefully compose a CODE table with specific whitespace layout, and then click "Source" again to go back to the visual mode, it also destroys white space.)

IBJoel Dec 22, 2020 8:27 am

OK, so how did you make the first block there? I can't replicate something I don't know how to do and need to be able to understand to explain to tech.

Zorak Dec 22, 2020 9:07 am


Originally Posted by IBJoel (Post 32904656)
OK, so how did you make the first block there?

I can't replicate something I don't know how to do and need to be able to understand to explain to tech.[/QUOTE]

I clicked on "Source" to enter raw source editing mode, lined it all up, and clicked Post without going back to WYSIWIG mode.

I *think* it works if you post in WYSIWIG mode but it's harder to line things up visually because it's not in a monospace font then.

Trying this out:

Code:

abc    def
ghi    jkl
mno  pqr

they don't look lined up as I'm typing this but there are exactly 3 spaces in between each group of letters, will see how it comes out.

Zorak Dec 22, 2020 9:12 am

Ok, well not sure why 3 spaces seems to have ballooned to 5 in the first few rows.

But anyway, here's what it looks like, as soon as I click "Edit" (but before clicking or typing anything else):
https://cimg8.ibsrv.net/gimg/www.fly...4b009b6757.png
although that section is rendered in a monospace font, note that all the whitespace has collapsed down to a single space.

(I didn't click "Save" so the whitespace in the previous post is preserved)

Not the most important bug in the world, but it's a hassle if you go back and edit a previous post because of typos or to correct/add info etc. and now you have to line everything up again in the table. I have not verified, but would suspect, that this bug affects wikis as well since it is the same editor?

IBJoel Dec 22, 2020 10:52 am

Code:

test normal
spacing words



Code:

test    aligned
spaced  words


IBJoel Dec 22, 2020 11:02 am

I'll ask tech to see if this can be fixed, but thankfully it's a small use case with an easy self-fix.

Zorak Dec 22, 2020 11:21 am


Originally Posted by IBJoel (Post 32905087)
I'll ask tech to see if this can be fixed, but thankfully it's a small use case with an easy self-fix.

I will agree to "small use case" but "easy self-fix" depends on the size of the table and the number of spaces :)

In any case thanks for passing this on!


All times are GMT -6. The time now is 1:09 am.


This site is owned, operated, and maintained by MH Sub I, LLC dba Internet Brands. Copyright © 2026 MH Sub I, LLC dba Internet Brands. All rights reserved. Designated trademarks are the property of their respective owners.