Warning, /education/cantor/thirdparty/discount-2.2.6-patched/mkd-callbacks.3 is written in an unsupported language. File is not indexed.

0001 .\"
0002 .Dd January 18, 2008
0003 .Dt MKD_CALLBACKS 3
0004 .Os Mastodon
0005 .Sh NAME
0006 .Nm mkd_callbacks 
0007 .Nd functions that modify link targets
0008 .Sh LIBRARY
0009 Markdown 
0010 .Pq libmarkdown , -lmarkdown
0011 .Sh SYNOPSIS
0012 .Fd #include <mkdio.h>
0013 .Ft char*
0014 .Fn (*mkd_callback_t) "const char*" "const int" "void*"
0015 .Ft void
0016 .Fn (*mkd_free_t) "char *" "void*"
0017 .Ft void
0018 .Fn mkd_e_url "MMIOT *document" "mkd_callback_t edit"
0019 .Ft void
0020 .Fn mkd_e_flags "MMIOT *document" "mkd_callback_t edit"
0021 .Ft void
0022 .Fn mkd_e_free "MMIOT *document" "mkd_free_t dealloc"
0023 .Ft void
0024 .Fn mkd_e_data  "MMIOT *document" "void *data"
0025 .Sh DESCRIPTION
0026 .Pp
0027 .Nm Discount
0028 provides a small set of data access functions to let a
0029 library user modify the targets given in a `[]' link, and to
0030 add additional flags to the generated link.
0031 .Pp
0032 The data access functions are passed a character pointer to
0033 the url being generated, the size of the url, and a data pointer
0034 pointing to a user data area (set by the
0035 .Fn mkd_e_data
0036 function.)     After the callback function is called (either
0037 .Fn mkd_e_url 
0038 or
0039 .Fn mkd_e_flags )
0040 the data freeing function (if supplied) is called and passed the
0041 character pointer and user data pointer.
0042 .Sh EXAMPLE
0043 The
0044 .Fn mkd_basename
0045 function (in the module basename.c) is implemented by means of
0046 mkd callbacks;  it modifies urls that start with a `/' so that
0047 they begin with a user-supplied url base by allocating a new
0048 string and filling it with the base + the url.  Discount plugs
0049 that url in in place of the original, then calls the basename
0050 free function (it only does this when
0051 .Fn mkd_e_url
0052 or
0053 .Fn mkd_e_flags
0054 returns nonzero) to deallocate this memory.
0055 .Pp
0056 Note that only one level of callbacks are supported; if you
0057 wish to do multiple callbacks, you need to write your own
0058 code to handle them all.
0059 .Sh SEE ALSO
0060 .Xr markdown 1 ,
0061 .Xr markdown 3 ,
0062 .Xr mkd-line 3 ,
0063 .Xr markdown 7 ,
0064 .Xr mkd-extensions 7 ,
0065 .Xr mmap 2 .
0066 .Pp
0067 basename.c
0068 .Pp
0069 http://daringfireball.net/projects/markdown/syntax
0070 .Sh BUGS
0071 Error handling is minimal at best.