473,382 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

better/easy way to displaying c source code in html

Greetings,
Are there any HTML editors which support syntax highlighting of c
program source code.

Let's say I write my html code as follows:
<html>
<body>

<code>
#include<stdio.h>
#define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0]))
int array[] = {23,34,12,17,204,99,16};
int main()
{
int d;
for(d=-1;d <= (TOTAL_ELEMENTS-2);d++)
printf("%d\n",array[d+1]);
return 0;
}
</code>
</body>
</html>

And the tool generates the real html code as displayed in colours as
shown here:
http://www.gowrikumar.com/c/index.html

Currently I'm using gvim to convert the c programs to HTML and then
including them
in the larger html page. But I soon found that it's becoming very
difficult to manage the website.

Also any other pointers for solutions for this sort web authoring,
where the site would predominantly contains c language source code, is
greatly appreciated.

Thanks in advance.

Regards,
Gowri Kumar

Jul 18 '06 #1
4 4417
gk*******@gmail.com wrote:
Are there any HTML editors which support syntax highlighting of c
program source code.
jEdit Just configure it so that it thinks HTML files (or even
".chtml" files) are C source.
OTOH, I wouldn't do this. HTML is HTML, C is C. Edit them as separate
files, then combine them through a pre-processor like SSI. If you edit
"C source" inside a HTML page then you can't test it and you'll see
errors sneaking through.

Jul 18 '06 #2
In article <11**********************@m79g2000cwm.googlegroups .com>,
<gk*******@gmail.comwrote:
>Are there any HTML editors which support syntax highlighting of c
program source code.
First, I know you have C program source, but I wanted to mention
that for highlighting PHP source, this is trivial to do inside HTML
files that incorporate PHP. There's a highlight_file() function
already built in. See the documentation for highlight_file() at
http://us2.php.net/manual/en/functio...light-file.php

For highlighting code in C++ or many other languages, you need the PEAR
Text_Highlighter package add-on to PHP (it's free).
http://pear.php.net/manual/en/packag...ighlighter.php

-Alex
Jul 18 '06 #3
Gazing into my crystal ball I observed gk*******@gmail.com writing in
news:11**********************@m79g2000cwm.googlegr oups.com:
Greetings,
Are there any HTML editors which support syntax highlighting of c
program source code.

Let's say I write my html code as follows:
<html>
<body>

<code>
#include<stdio.h>
#define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0]))
int array[] = {23,34,12,17,204,99,16};
int main()
{
int d;
for(d=-1;d <= (TOTAL_ELEMENTS-2);d++)
printf("%d\n",array[d+1]);
return 0;
}
</code>
</body>
</html>

And the tool generates the real html code as displayed in colours as
shown here:
http://www.gowrikumar.com/c/index.html

Currently I'm using gvim to convert the c programs to HTML and then
including them
in the larger html page. But I soon found that it's becoming very
difficult to manage the website.

Also any other pointers for solutions for this sort web authoring,
where the site would predominantly contains c language source code, is
greatly appreciated.
You may want to try HTML-Kit, an excellent HTML editor, with syntax
highlighting for myriad languages. There are hundreds of plugins
available, and this one <http://www.chami.com/html-
kit/plugins/info/codepublisher/may be the one you are looking for.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Jul 19 '06 #4
Greetings,
Thanks for all the replies. I would try following the suggestions
provided and
would come back if I find any difficulty.

Regards,
Gowri Kumar

AdriHenne Boswell wrote:
Gazing into my crystal ball I observed gk*******@gmail.com writing in
news:11**********************@m79g2000cwm.googlegr oups.com:
Greetings,
Are there any HTML editors which support syntax highlighting of c
program source code.

Let's say I write my html code as follows:
<html>
<body>

<code>
#include<stdio.h>
#define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0]))
int array[] = {23,34,12,17,204,99,16};
int main()
{
int d;
for(d=-1;d <= (TOTAL_ELEMENTS-2);d++)
printf("%d\n",array[d+1]);
return 0;
}
</code>
</body>
</html>

And the tool generates the real html code as displayed in colours as
shown here:
http://www.gowrikumar.com/c/index.html

Currently I'm using gvim to convert the c programs to HTML and then
including them
in the larger html page. But I soon found that it's becoming very
difficult to manage the website.

Also any other pointers for solutions for this sort web authoring,
where the site would predominantly contains c language source code, is
greatly appreciated.

You may want to try HTML-Kit, an excellent HTML editor, with syntax
highlighting for myriad languages. There are hundreds of plugins
available, and this one <http://www.chami.com/html-
kit/plugins/info/codepublisher/may be the one you are looking for.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Jul 24 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: John | last post by:
I have over 5000 thumbnail pictures of size 5kb each. I would like to able to load all 5000 pictures and view 50 per page using mysql_data_seek(). I would like to know what are the advantages and...
19
by: Mary Pegg | last post by:
There's got to be a better way: if (isset($c)) echo $c."<br>"; if (isset($c)) echo $c."<br>"; if (isset($c)) echo $c."<br>"; if (isset($c)) echo $c."<br>"; if (isset($c)) echo $c."<br>"; but...
6
by: Christopher Vogt | last post by:
Hej everybody, I built something for myself that might help some of you as well. Looking at a couple of PHP template engines made me think. I have two main requirements for a presentation...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.