FlyerTalk Forums - View Single Post - whitespace inside CODE tag is not preserved
Old Dec 21, 2020 | 7:40 pm
  #1  
Zorak
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,701
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