|
NAME
DESCRIPTIONThe Basic usage will be:
EXAMPLESSimple example that uses first argument as a markdown string, converts it to an HTML and outputs it to stdout. #include <stdio.h>
#include <buffer.h>
#include <markdown.h>
#include <renderers.h>
#define INPUT_UNIT 1024
#define OUTPUT_UNIT 64
int
main(int argc, char *argv[])
{
struct buf *ib, *ob;
/* Make sure we have enough arguments. */
if (argc != 2) {
return 1;
}
ib = bufnew(INPUT_UNIT);
ob = bufnew(OUTPUT_UNIT);
/* bufputs() is a wrapper over bufput() for NUL-terminated string. */
bufputs(ib, argv[1]);
markdown(ob, ib, &mkd_html);
/* Note the resulted data is not NUL-terminated string;
* to make it use bufnullterm(). */
printf("%.*s", (int)ob->size, ob->data);
bufrelease(ib);
bufrelease(ob);
return 0;
}
SEE ALSOsoldout_array(3), soldout_buffer(3), soldout_markdown(3), soldout_renderers(3), John Gruber's markdown format AUTHORSThe
|