Here is the CSS element which I am using to display the source code in this post:
/* Custom styling ----------------------------- */I added this code to my blog template in the <b:skin> section of the template just about the Comments section.
.displaybox, .displaybox pre
{
font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace;
font-size: 12px;
color: black;
background-color: RGB(245,218,199);
border: 1px dashed #999999;
line-height: 14px;
padding: 5px;
overflow: auto;
width: 100%
}
Here is a sample of the output for a simple C function. No changes had to be made to the source code except to change the include header angle brackets to < and > respectively.
#include <shell.h>This custom CSS element in my blog template will not eliminate the need to make any changes to source code before including the code in a post but it does simplify things. With this CSS element in place, the only parts of the source code that I should have to manually edit in order to display correctly are angle brackets, ampersands and quotation marks.
int
b_hello(int argc, char *argv[], void *extra
{
if (argc != 2) {
printf("Usage: hello arg\n");
return(2);
}
printf("Hello %s\n", argv[1]);
return(0);
}
0 comments:
Post a Comment