1MKD_CALLBACKS(3)         BSD Library Functions Manual         MKD_CALLBACKS(3)
2

NAME

4     mkd_callbacks — functions that modify link targets
5

LIBRARY

7     Markdown (libmarkdown, -lmarkdown)
8

SYNOPSIS

10     #include <mkdio.h>
11
12     char*
13     (*mkd_callback_t)(const char*, const int, void*);
14
15     void
16     (*mkd_free_t)(char *, void*);
17
18     void
19     mkd_e_url(MMIOT *document, mkd_callback_t edit);
20
21     void
22     mkd_e_flags(MMIOT *document, mkd_callback_t edit);
23
24     void
25     mkd_e_free(MMIOT *document, mkd_free_t dealloc);
26
27     void
28     mkd_e_data(MMIOT *document, void *data);
29

DESCRIPTION

31     Discount provides a small set of data access functions to let a library
32     user modify the targets given in a `[]' link, and to add additional flags
33     to the generated link.
34
35     The data access functions are passed a character pointer to the url being
36     generated, the size of the url, and a data pointer pointing to a user
37     data area (set by the mkd_e_data() function.)     After the callback
38     function is called (either mkd_e_url() or mkd_e_flags()) the data freeing
39     function (if supplied) is called and passed the character pointer and
40     user data pointer.
41

EXAMPLE

43     The mkd_basename() function (in the module basename.c) is implemented by
44     means of mkd callbacks;  it modifies urls that start with a `/' so that
45     they begin with a user-supplied url base by allocating a new string and
46     filling it with the base + the url.  Discount plugs that url in in place
47     of the original, then calls the basename free function (it only does this
48     when mkd_e_url() or mkd_e_flags() returns nonzero) to deallocate this
49     memory.
50
51     Note that only one level of callbacks are supported; if you wish to do
52     multiple callbacks, you need to write your own code to handle them all.
53

SEE ALSO

55     markdown(1), markdown(3), mkd-line(3), markdown(7), mkd-extensions(7),
56     mmap(2).
57
58     basename.c
59
60     http://daringfireball.net/projects/markdown/syntax
61

BUGS

63     Error handling is minimal at best.
64
65Mastodon                       January 18, 2008                       Mastodon
Impressum