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

0001 .\"
0002 .Dd December 20, 2007
0003 .Dt MARKDOWN 3
0004 .Os Mastodon
0005 .Sh NAME
0006 .Nm markdown
0007 .Nd process Markdown documents
0008 .Sh LIBRARY
0009 Markdown 
0010 .Pq libmarkdown , -lmarkdown
0011 .Sh SYNOPSIS
0012 .Fd #include <mkdio.h>
0013 .Ft MMIOT
0014 .Fn *mkd_in "FILE *input" "int flags"
0015 .Ft MMIOT
0016 .Fn *mkd_string "char *string" "int size" "int flags"
0017 .Ft int
0018 .Fn markdown "MMIOT *doc" "FILE *output" "int flags"
0019 .Sh DESCRIPTION
0020 These functions
0021 convert
0022 .Em Markdown
0023 documents and strings into HTML.
0024 .Fn markdown
0025 processes an entire document, while
0026 .Fn mkd_text
0027 processes a single string.
0028 .Pp
0029 To process a file, you pass a FILE* to
0030 .Fn mkd_in ,
0031 and if it returns a nonzero value you pass that in to 
0032 .Fn markdown ,
0033 which then writes the converted document to the specified
0034 .Em FILE* .
0035 If your input has already been written into a string (generated
0036 input or a file opened 
0037 with 
0038 .Xr mmap 2 )
0039 you can feed that string to 
0040 .Fn mkd_string
0041 and pass its return value to
0042 .Fn markdown.
0043 .Pp
0044 .Fn Markdown
0045 accepts the following flag values (or-ed together if needed)
0046 to restrict how it processes input:
0047 .Bl -tag -width MKD_NOSTRIKETHROUGH -compact
0048 .It Ar MKD_NOLINKS
0049 Don't do link processing, block 
0050 .Em <a>
0051 tags.
0052 .It Ar MKD_NOIMAGE
0053 Don't do image processing, block
0054 .Em <img> .
0055 .It Ar MKD_NOPANTS
0056 Don't run 
0057 .Em smartypants() .
0058 .It Ar MKD_NOHTML
0059 Don't allow raw html through AT ALL
0060 .It Ar MKD_STRICT
0061 Disable 
0062 superscript and relaxed emphasis.
0063 .It Ar MKD_TAGTEXT
0064 Process text to put inside an html tag (ID=, NAME=, <title>, &tc); no 
0065 .Em <em> ,
0066 no 
0067 .Em <bold> ,
0068 no html or
0069 .Em []
0070 expansion.
0071 .It Ar MKD_NO_EXT
0072 Don't allow pseudo-protocols.
0073 .It Ar MKD_CDATA
0074 Generate code for xml 
0075 .Em ![CDATA[...]] .
0076 .It Ar MKD_NOSUPERSCRIPT
0077 Don't generate superscripts.
0078 Emphasis happens _everywhere_
0079 .It Ar MKD_NOTABLES
0080 Disallow tables.
0081 .It Ar MKD_NOSTRIKETHROUGH
0082 Forbid 
0083 .Em ~~strikethrough~~ .
0084 .It Ar MKD_TOC
0085 Do table-of-contents processing.
0086 .It Ar MKD_1_COMPAT
0087 Compatibility with MarkdownTest_1.0
0088 .It Ar MKD_AUTOLINK
0089 Make 
0090 .Em http://foo.com
0091 into a link even without
0092 .Em <> s.
0093 .It Ar MKD_SAFELINK
0094 Paranoid check for link protocol.
0095 .It Ar MKD_NOHEADER
0096 Don't process header blocks.
0097 .It Ar MKD_TABSTOP
0098 Expand tabs to 4 spaces.
0099 .It Ar MKD_NODIVQUOTE
0100 Forbid 
0101 .Em >%class%
0102 blocks.
0103 .It Ar MKD_NOALPHALIST
0104 Forbid alphabetic lists.
0105 .It Ar MKD_NODLIST
0106 Forbid definition lists.
0107 .It Ar MKD_NODLDISCOUNT
0108 Disable the discount definition list syntax style.
0109 .It Ar MKD_DLEXTRA
0110 Enable the extra definition list syntax style.
0111 .It Ar MKD_EXTRA_FOOTNOTE
0112 Enable markdown extra-style footnotes.
0113 .It Ar MKD_NOSTYLE
0114 Do not extract (omit) <style/> blocks from the output.
0115 .It Ar MKD_FENCEDCODE
0116 Allow fenced code blocks.
0117 .It Ar MKD_IDANCHOR
0118 Use id= anchors instead of <a name=/> for table-of-contents links.
0119 .It Ar MKD_GITHUBTAGS
0120 Allow underscore and dash in passed through element names.
0121 .It Ar MKD_URLENCODEDANCHOR
0122 Use html5 encoding for multibyte and nonalphanumeric characters rather
0123 than hex expansion in toc links.
0124 .El
0125 .Sh RETURN VALUES
0126 .Fn markdown
0127 returns 0 on success, 1 on failure.
0128 The
0129 .Fn mkd_in
0130 and
0131 .Fn mkd_string
0132 functions return a MMIOT* on success, null on failure.
0133 .Sh SEE ALSO
0134 .Xr markdown 1 ,
0135 .Xr mkd-callbacks 3 ,
0136 .Xr mkd-functions 3 ,
0137 .Xr mkd-line 3 ,
0138 .Xr markdown 7 ,
0139 .Xr mkd-extensions 7 ,
0140 .Xr mmap 2 .
0141 .Pp
0142 http://daringfireball.net/projects/markdown/syntax
0143 .Sh BUGS
0144 Error handling is minimal at best.
0145 .Pp
0146 The
0147 .Ar MMIOT
0148 created by
0149 .Fn mkd_string
0150 is deleted by the
0151 .Nm
0152 function.