<commit_before>.\"
.Dd December 20, 2007
.Dt MARKDOWN 3
.Os Mastodon
.Sh NAME
.Nm markdown
.Nd process Markdown documents
.Sh LIBRARY
Markdown 
.Pq libmarkdown , -lmarkdown
.Sh SYNOPSIS
.Fd #include <mkdio.h>
.Ft MMIOT
.Fn *mkd_in "FILE *input" "int flags"
.Ft MMIOT
.Fn *mkd_string "char *string" "int size" "int flags"
.Ft int
.Fn markdown "MMIOT *doc" "FILE *output" "int flags"
.Sh DESCRIPTION
These functions
convert
.Em Markdown
documents and strings into HTML.
.Fn markdown
processes an entire document, while
.Fn mkd_text
processes a single string.
.Pp
To process a file, you pass a FILE* to
.Fn mkd_in ,
and if it returns a nonzero value you pass that in to 
.Fn markdown ,
which then writes the converted document to the specified
.Em FILE* .
If your input has already been written into a string (generated
input or a file opened 
with 
.Xr mmap 2 )
you can feed that string to 
.Fn mkd_string
and pass its return value to
.Fn markdown.
.Pp
.Fn Markdown
accepts the following flag values (or-ed together if needed)
to restrict how it processes input:
.Bl -tag -width MKD_NOSTRIKETHROUGH -compact
.It Ar MKD_NOLINKS
Don't do link processing, block 
.Em <a>
tags.
.It Ar MKD_NOIMAGE
Don't do image processing, block
.Em <img> .
.It Ar MKD_NOPANTS
Don't run 
.Em smartypants() .
.It Ar MKD_NOHTML
Don't allow raw html through AT ALL
.It Ar MKD_STRICT
Disable 
superscript and relaxed emphasis.
.It Ar MKD_TAGTEXT
Process text inside an html tag; no 
.Em <em> ,
no 
.Em <bold> ,
no html or
.Em []
expansion.
.It Ar MKD_NO_EXT
Don't allow pseudo-protocols.
.It Ar MKD_CDATA
Generate code for xml 
.Em ![CDATA[...]] .
.It Ar MKD_NOSUPERSCRIPT
Don't generate superscripts.
Emphasis happens _everywhere_
.It Ar MKD_NOTABLES
Disallow tables.
.It Ar MKD_NOSTRIKETHROUGH
Forbid 
.Em ~~strikethrough~~ .
.It Ar MKD_TOC
Do table-of-contents processing.
.It Ar MKD_1_COMPAT
Compatibility with MarkdownTest_1.0
.It Ar MKD_AUTOLINK
Make 
.Em http://foo.com
into a link even without
.Em <> s.
.It Ar MKD_SAFELINK
Paranoid check for link protocol.
.It Ar MKD_NOHEADER
Don't process header blocks.
.It Ar MKD_TABSTOP
Expand tabs to 4 spaces.
.It Ar MKD_NODIVQUOTE
Forbid 
.Em >%class%
blocks.
.It Ar MKD_NOALPHALIST
Forbid alphabetic lists.
.It Ar MKD_NODLIST
Forbid definition lists.
.It Ar MKD_EXTRA_FOOTNOTE<commit_msg>Add documentation runtime definition list style API flags.<commit_after>.\"
.Dd December 20, 2007
.Dt MARKDOWN 3
.Os Mastodon
.Sh NAME
.Nm markdown
.Nd process Markdown documents
.Sh LIBRARY
Markdown 
.Pq libmarkdown , -lmarkdown
.Sh SYNOPSIS
.Fd #include <mkdio.h>
.Ft MMIOT
.Fn *mkd_in "FILE *input" "int flags"
.Ft MMIOT
.Fn *mkd_string "char *string" "int size" "int flags"
.Ft int
.Fn markdown "MMIOT *doc" "FILE *output" "int flags"
.Sh DESCRIPTION
These functions
convert
.Em Markdown
documents and strings into HTML.
.Fn markdown
processes an entire document, while
.Fn mkd_text
processes a single string.
.Pp
To process a file, you pass a FILE* to
.Fn mkd_in ,
and if it returns a nonzero value you pass that in to 
.Fn markdown ,
which then writes the converted document to the specified
.Em FILE* .
If your input has already been written into a string (generated
input or a file opened 
with 
.Xr mmap 2 )
you can feed that string to 
.Fn mkd_string
and pass its return value to
.Fn markdown.
.Pp
.Fn Markdown
accepts the following flag values (or-ed together if needed)
to restrict how it processes input:
.Bl -tag -width MKD_NOSTRIKETHROUGH -compact
.It Ar MKD_NOLINKS
Don't do link processing, block 
.Em <a>
tags.
.It Ar MKD_NOIMAGE
Don't do image processing, block
.Em <img> .
.It Ar MKD_NOPANTS
Don't run 
.Em smartypants() .
.It Ar MKD_NOHTML
Don't allow raw html through AT ALL
.It Ar MKD_STRICT
Disable 
superscript and relaxed emphasis.
.It Ar MKD_TAGTEXT
Process text inside an html tag; no 
.Em <em> ,
no 
.Em <bold> ,
no html or
.Em []
expansion.
.It Ar MKD_NO_EXT
Don't allow pseudo-protocols.
.It Ar MKD_CDATA
Generate code for xml 
.Em ![CDATA[...]] .
.It Ar MKD_NOSUPERSCRIPT
Don't generate superscripts.
Emphasis happens _everywhere_
.It Ar MKD_NOTABLES
Disallow tables.
.It Ar MKD_NOSTRIKETHROUGH
Forbid 
.Em ~~strikethrough~~ .
.It Ar MKD_TOC
Do table-of-contents processing.
.It Ar MKD_1_COMPAT
Compatibility with MarkdownTest_1.0
.It Ar MKD_AUTOLINK
Make 
.Em http://foo.com
into a link even without
.Em <> s.
.It Ar MKD_SAFELINK
Paranoid check for link protocol.
.It Ar MKD_NOHEADER
Don't process header blocks.
.It Ar MKD_TABSTOP
Expand tabs to 4 spaces.
.It Ar MKD_NODIVQUOTE
Forbid 
.Em >%class%
blocks.
.It Ar MKD_NOALPHALIST
Forbid alphabetic lists.
.It Ar MKD_NODLIST
Forbid definition lists.
.It Ar MKD_NODLDISCOUNT
Disable the discount definition list syntax style.
.It Ar MKD_DLEXTRA
Enable the extra definition list syntax style.
.It Ar MKD_EXTRA_FOOTNOTE
{'fraction_non_alphanumeric': 0.07709891936824605, 'fraction_numerical': 0.004987531172069825, 'mean_word_length': 3.8763931104356635, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3649367', 'n_tokens_mistral': 1897, 'n_tokens_neox': 1765, 'n_words': 724}