Setting tab width for pre-formatted code

This forum is for all Flare issues not related to any of the other categories.
Post Reply
cherid
Jr. Propeller Head
Posts: 3
Joined: Tue Nov 17, 2015 12:21 pm

Setting tab width for pre-formatted code

Post by cherid »

Anyone know where you can set the tab width? I'm inserting code into a <pre> tag, and it appears that the default for tabs is 8 characters. I'd like to make that smaller. Can I? I've hunted and hunted and can't seem to find anything about this.
Thanks!
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Setting tab width for pre-formatted code

Post by LTinker68 »

You can adjust the margin values for the <pre> tag in the stylesheet editor, same as any other tag. BTW, that 8 character length might be browser-dependent, so if your users might use any browser, then you might want to test your output in multiple browsers to make sure you didn't move it too far. For example, browsers indent bullets different amounts, so a margin-left value of 0 in one browser may put it flush left to the margin, but in another browser it may appear as if it were a negative margin or still indented a few characters. It's extremely annoying how they aren't consistent. So if you adjust the margin-left of the <pre> tag, make sure you test it in multiple browsers.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
moshe
Propeller Head
Posts: 46
Joined: Tue Apr 05, 2016 10:10 pm
Location: Jerusalem, Israel

Re: Setting tab width for pre-formatted code

Post by moshe »

If I understand correctly, the question wasn't about margins for the HTML pre tag, rather how to set tabs that you are using within the pre tag to display things like code indentation. You want the tabs to be less than 8 characters wide so you can properly display stuff like code that has multiple levels of indentation. When the tab takes up 8 characters, the indentation takes up too much space.

Setting a left margin for the pre tag will move the entire code block, but won't affect the tabs within the code block.

The proper way to do this is using the CSS tab-size property, but it appears that Flare doesn't properly recognize this CSS property.
Similarly, there is a CSS white-space property, which is supposed to be able to control the wrapping of long lines of text. This also can be useful in properly displaying code blocks. However, it appears that Flare doesn't properly recognize this CSS property either.

I hope that I'm wrong about Flare not recognizing these CSS properties, but in a current Flare project, I can't get them to work.

Hope this helps,
Moshe
Moshe Davis
Jerusalem, Israel
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Setting tab width for pre-formatted code

Post by NorthEast »

The Flare editor doesn't display a lot of CSS properties, but if you check the output they should work.

You could use tab-size, but it appears it isn't supported in all browsers.
http://www.w3schools.com/cssref/css3_pr_tab-size.asp
Post Reply