auto tab in C to HTML -


how can convert auto tabs in c code html, neat in html aligned. safe use 4spaces? times, 1tab not 4 spaces, 1,2, or 3 space only. pls help, thanks!

int x ;             /* comment tab  */ x = 0u ;            /* comment tab  */  if ( gvar == 3u)    /* comment tab  */ {                   /* comment tab  */     x++ ;           /* comment tab  */ }                   /* comment tab  */ gvar = 99u ;        /* comment tab  */  return ( 0 )        /* comment tab  */ 

well can't blithely convert every tab 4 spaces. that's not how tabs work. instead want each tab character advance output position next tab stop.

you have 2 options:

1. specify css tab-size:

pre { tab-size: 4; -o-tab-size: 4; -moz-tab-size: 4; }
<pre>  int main() {  	return 0;		/* comment */  }  </pre>

this simplest solution, unfortunately the tab-size rule isn't recognized ie or edge.

2. pre-process source code:

pipe c source code through expand command line utility convert tabs spaces. example:

expand -t4 <c_source.c >c_source_with_expanded_tabs.c 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -