473,549 Members | 2,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,20 4,99,16};
int main()
{
int d;
for(d=-1;d <= (TOTAL_ELEMENTS-2);d++)
printf("%d\n",a rray[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 4431
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************ **********@m79g 2000cwm.googleg roups.com>,
<gk*******@gmai l.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_Highlighte r 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.goo glegroups.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,20 4,99,16};
int main()
{
int d;
for(d=-1;d <= (TOTAL_ELEMENTS-2);d++)
printf("%d\n",a rray[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.goo glegroups.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,20 4,99,16};
int main()
{
int d;
for(d=-1;d <= (TOTAL_ELEMENTS-2);d++)
printf("%d\n",a rray[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
7077
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 disadvantages of using a MySQL blob field rather than reading the images directly from the file? How does one insert an image into a blob field?...
19
1658
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 it's late and my brain is frazzled. Any ideas, oh PHP gurus? --
6
1325
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 layer framework: - use PHP as the template language - effective XSS prevention without betting on discipline Plain PHP only satisfies the first. I...
7
6639
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 tabcontainer which has 1 panel already, however I want to try create the TabPanels dynamically. I followed the advice here: ...
0
7541
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7979
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7826
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6065
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5107
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3512
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
781
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.