more docs
This commit is contained in:
@@ -56,6 +56,13 @@ The HTML comes with no styling. If you want to apply a CSS to it, you can provid
|
||||
|
||||
This will basically add a `<style>` element with the contents of the `style.css` file before the normal HTML output.
|
||||
|
||||
### --prefix
|
||||
By the fault, all of the HTML class names are prefixed with `c2h-` to avoid namespace collisions. You can change the prefix using the `--prefix` option, like this:
|
||||
```sh
|
||||
./c2html --input file.c --output file.html --prefix myprefix-
|
||||
```
|
||||
in which case, identifiers will be generated with the `myprefix-identifier` class name instead of the usual `c2h-identifier`.
|
||||
|
||||
## Using the library
|
||||
The library only exports one function
|
||||
```c
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
// Build with: gcc example.c c2html.c -o example -Wall -Wextra
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "c2html.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Table mode refers to the structure of the output HTML.
|
||||
// If table_mode is turned off, then the output lines are
|
||||
// separated by <br /> tags and there are no line numbers.
|
||||
// Using table mode, then the lines are represented as rows
|
||||
// of an HTML. The table has a first column with the line
|
||||
// numbers and the second with their content.
|
||||
_Bool table_mode = 0;
|
||||
const char *prefix = NULL;
|
||||
|
||||
char *c =
|
||||
"int main() {\n"
|
||||
" int a = 5;\n"
|
||||
" return 0;\n"
|
||||
"}\n";
|
||||
|
||||
char *html = c2html(c, strlen(c), table_mode, prefix, NULL);
|
||||
|
||||
/* .. check for errors .. */
|
||||
|
||||
printf("%s\n", html);
|
||||
|
||||
free(html);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user