Go Back  FlyerTalk Forums > Support&Services > Technical Support and Feedback
Reload this Page >

whitespace inside CODE tag is not preserved

Community
Wiki Posts
Search

whitespace inside CODE tag is not preserved

Thread Tools
 
Search this Thread
 
Old Dec 21, 2020 | 7:40 pm
  #1  
Original Poster
Moderator: Hyatt, American Express; FlyerTalk Evangelist
Community Builder
Active Streak: 30 Days
All eyes on you!
10 Years on Site
 
Join Date: Jun 2015
Location: WAS
Programs: :rolleyes:, DL DM, AA EXP, UA Silver, Hyatt Glob, Mlife Noir (=> Marriott Amb), invol FT beta tester
Posts: 21,634
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.)
Zorak is offline  
Old Dec 22, 2020 | 8:27 am
  #2  
Administrator
10 Countries Visited
Conversation Starter
All eyes on you!
10 Years on Site
 
Join Date: Sep 2015
Location: Los Angeles
Programs: Internet Brands
Posts: 4,435
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.
IBJoel is offline  
Old Dec 22, 2020 | 9:07 am
  #3  
Original Poster
Moderator: Hyatt, American Express; FlyerTalk Evangelist
Community Builder
Active Streak: 30 Days
All eyes on you!
10 Years on Site
 
Join Date: Jun 2015
Location: WAS
Programs: :rolleyes:, DL DM, AA EXP, UA Silver, Hyatt Glob, Mlife Noir (=> Marriott Amb), invol FT beta tester
Posts: 21,634
Originally Posted by IBJoel
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 is offline  
Old Dec 22, 2020 | 9:12 am
  #4  
Original Poster
Moderator: Hyatt, American Express; FlyerTalk Evangelist
Community Builder
Active Streak: 30 Days
All eyes on you!
10 Years on Site
 
Join Date: Jun 2015
Location: WAS
Programs: :rolleyes:, DL DM, AA EXP, UA Silver, Hyatt Glob, Mlife Noir (=> Marriott Amb), invol FT beta tester
Posts: 21,634
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):

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?
Zorak is offline  
Old Dec 22, 2020 | 10:52 am
  #5  
Administrator
10 Countries Visited
Conversation Starter
All eyes on you!
10 Years on Site
 
Join Date: Sep 2015
Location: Los Angeles
Programs: Internet Brands
Posts: 4,435
Code:
test normal
spacing words


Code:
test    aligned
spaced  words

Last edited by IBJoel; Dec 22, 2020 at 11:01 am
IBJoel is offline  
Old Dec 22, 2020 | 11:02 am
  #6  
Administrator
10 Countries Visited
Conversation Starter
All eyes on you!
10 Years on Site
 
Join Date: Sep 2015
Location: Los Angeles
Programs: Internet Brands
Posts: 4,435
I'll ask tech to see if this can be fixed, but thankfully it's a small use case with an easy self-fix.
IBJoel is offline  
Old Dec 22, 2020 | 11:21 am
  #7  
Original Poster
Moderator: Hyatt, American Express; FlyerTalk Evangelist
Community Builder
Active Streak: 30 Days
All eyes on you!
10 Years on Site
 
Join Date: Jun 2015
Location: WAS
Programs: :rolleyes:, DL DM, AA EXP, UA Silver, Hyatt Glob, Mlife Noir (=> Marriott Amb), invol FT beta tester
Posts: 21,634
Originally Posted by IBJoel
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!
Zorak is offline  


Contact Us - Archive - Advertising - Cookie Policy - Privacy Statement - Terms of Service -

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.