Skip to content
Newer
Older
100644 115 lines (113 sloc) 2.25 KB
22f53ba Write the manpage for the markdown functions, modify the makefile so
david parsons authored
1 .\"
2 .Dd December 20, 2007
3 .Dt MARKDOWN 3
4 .Os Mastodon
5 .Sh NAME
0ddb1dc New function isthisspace() which returns true if (isspace() || EOF); …
david parsons authored
6 .Nm markdown
22f53ba Write the manpage for the markdown functions, modify the makefile so
david parsons authored
7 .Nd process Markdown documents
732bb45 misc manpage and function scope repairs
David Parsons authored
8 .Sh LIBRARY
9 Markdown
10 .Pq libmarkdown , -lmarkdown
22f53ba Write the manpage for the markdown functions, modify the makefile so
david parsons authored
11 .Sh SYNOPSIS
12 .Fd #include <mkdio.h>
13 .Ft void*
14 .Fn mkd_in "FILE *input"
15 .Ft void*
16 .Fn mkd_string "char *string" "int size"
0ddb1dc New function isthisspace() which returns true if (isspace() || EOF); …
david parsons authored
17 .Ft int
f33e9f3 Use the new **MMIOT** abstract type in the manpage instead of `void *…
david parsons authored
18 .Fn markdown "MMIOT" "FILE *output" "int flags"
0ddb1dc New function isthisspace() which returns true if (isspace() || EOF); …
david parsons authored
19 .Ft int
20 .Fn mkd_text "char *string" "int size" "FILE *output" "int flags"
22f53ba Write the manpage for the markdown functions, modify the makefile so
david parsons authored
21 .Sh DESCRIPTION
22 These functions
23 convert
24 .Em Markdown
25 documents and strings into HTML.
26 .Fn markdown
27 processes an entire document, while
28 .Fn mkd_text
29 processes a single string.
30 .Pp
31 The
32 .Fn markdown
33 function expects to recieve a preprocessed text from the
34 .Fn mkd_in
35 or
36 .Fn mkd_string
37 functions, while
38 .Fn mkd_text
39 treats your input text as a single paragraph of markup.
40 .Pp
41 To process a file, you pass a FILE* to
42 .Fn mkd_in ,
43 and if it returns a nonzero value you pass that in to
44 .Fn markdown ,
45 which then writes the converted document to the specified
46 .Em FILE* .
47 If your input has already been written into a string (generated
48 input or a file opened
49 with
50 .Xr mmap 2 )
51 you can feed that string to
52 .Fn mkd_string
53 and pass its return value to
54 .Fn markdown.
55 .Pp
56 .Fn Markdown
57 and
58 .Fn mkd_text
59 accept the following flag values (or-ed together if needed)
60 to restrict how they process their input:
19d8121 Implement MKD_NOIMAGE, MKD_NOLINKS, MKD_NOSMARTY; reparse the target
david parsons authored
61 .Bl -tag -width MKD_NOIMAGE -compact
62 .It Ar MKD_NOIMAGE
63 Do not process `![]' and
64 remove
22f53ba Write the manpage for the markdown functions, modify the makefile so
david parsons authored
65 .Em \<img\>
66 tags from the output.
67 .It Ar MKD_NOLINKS
19d8121 Implement MKD_NOIMAGE, MKD_NOLINKS, MKD_NOSMARTY; reparse the target
david parsons authored
68 Do not process `[]' and remove
22f53ba Write the manpage for the markdown functions, modify the makefile so
david parsons authored
69 .Em \<a\>
70 tags from the output.
19db8db Take out the (#if 0'ed) code to expand `>` to `&gt;` in text().
david parsons authored
71 .It Ar MKD_NOPANTS
0ddb1dc New function isthisspace() which returns true if (isspace() || EOF); …
david parsons authored
72 Do not do Smartypants-style mangling of quotes, dashes, or ellipses.
cb3fb68 Document the MKD_QUOT, MKD_NOHEADER, MKD_TABSTOP flags.
david parsons authored
73 .It Ar MKD_QUOT
74 Expand
75 .Ar \&"
76 to \&&quot;.
77 .It Ar MKD_NOHEADER
78 Do not attempt to parse any Pandoc-style headers.
79 .It Ar MKD_TABSTOP
80 When reading documents, expand tabs to
81 .Em 4
82 spaces instead of whatever
83 .Nm
84 was originally configured for.
22f53ba Write the manpage for the markdown functions, modify the makefile so
david parsons authored
85 .El
86 .Sh RETURN VALUES
87 The functions
88 .Fn markdown
89 and
90 .Fn mkd_text
91 return 0 on success, 1 on failure.
92 The
93 .Fn mkd_in
94 and
95 .Fn mkd_string
f33e9f3 Use the new **MMIOT** abstract type in the manpage instead of `void *…
david parsons authored
96 functions return a MMIOT on success, null on failure.
22f53ba Write the manpage for the markdown functions, modify the makefile so
david parsons authored
97 .Sh SEE ALSO
98 .Xr markdown 1 ,
99 .Xr markdown 7 ,
100 .Xr mmap 2 .
101 .Pp
102 http://daringfireball.net/projects/markdown/syntax
103 .Sh BUGS
104 Error handling is minimal at best.
0ddb1dc New function isthisspace() which returns true if (isspace() || EOF); …
david parsons authored
105 .Pp
106 The
107 descriptor returned by
108 .Fn mkd_text
109 and
110 .Fn mkd_string
111 will be destroyed upon return from the
112 .Nm
113 function.
114
Something went wrong with that request. Please try again.