42#ifndef libMultiMarkdown7_H
43#define libMultiMarkdown7_H
51typedef struct read_ctx read_ctx;
52typedef struct stack stack;
58void mmd_process_file(FILE * in, FILE * out, uint32_t options,
const char * search_path,
const char * source_path);
59void mmd_process_filename(
const char * fname, FILE * out, uint32_t options,
const char * search_path);
60void mmd_process_str(
const char * text, FILE * out, uint32_t options,
const char * search_path,
const char * source_path);
61void mmd_process_str_len(
const char * text,
size_t in_len, FILE * out, uint32_t options,
const char * search_path,
const char * source_path);
66char *
mmd_process_file_to_str(FILE * in,
size_t * out_len, uint32_t options,
const char * search_path,
const char * source_path);
67char * mmd_process_filename_to_str(
const char * fname,
size_t * out_len, uint32_t options,
const char * search_path);
68char * mmd_process_str_to_str(
const char * text,
size_t * out_len, uint32_t options,
const char * search_path,
const char * source_path);
69char * mmd_process_str_len_to_str(
const char * text,
size_t in_len,
size_t * out_len, uint32_t options,
const char * search_path,
const char * source_path);
79mmd_node * mmd_parse_filename(
const char * filename, read_ctx * c, uint32_t options);
80mmd_node * mmd_parse_str(
const char * text, read_ctx * c, uint32_t options);
81mmd_node * mmd_parse_str_len(
const char * text,
size_t in_len, read_ctx * c, uint32_t options);
88void mmd_ast_filename(
const char * fname, FILE * out, uint32_t options);
89void mmd_ast_str(
const char * text, FILE * out, uint32_t options);
90void mmd_ast_str_len(
const char * text,
size_t in_len, FILE * out, uint32_t options);
97read_ctx * mmd_metadata_file(FILE * in, uint32_t options);
98read_ctx * mmd_metadata_str(
const char * text, uint32_t options);
99read_ctx * mmd_metadata_str_len(
const char * text,
size_t in_len, uint32_t options);
105void mmd_node_tree_free(
mmd_node * n);
117void read_ctx_reset(read_ctx * c, uint32_t options);
118void read_ctx_free(read_ctx * c);
120void custom_seed_rand(
void);
132 FORMAT_TEXTBUNDLE_COMPRESSED,
136 FORMAT_HTML_WITH_ASSETS,
179#define MMD_OUT_FORMAT_MASK 0x1f
180#define MMD_SMART_QUOTE_MASK 0x01e0
181#define MMD_LANGUAGE_MASK 0x1E00
184#define MMD_OUT_FORMAT_FROM_OPTS(x) ((x & MMD_OUT_FORMAT_MASK) >> 0)
187#define MMD_SMART_QUOTE_FROM_OPTS(x) ((x & MMD_SMART_QUOTE_MASK) >> 5)
190#define MMD_LANGUAGE_FROM_OPTS(x) ((x & MMD_LANGUAGE_MASK) >> 9)
221#define MMD_TYPE_MASK 0xc0
222#define MMD_TOKEN_MASK 0x80
224#define MMD_NODE_IS_LINE(x) ((((mmd_node*)x)->type & MMD_TYPE_MASK) == 0x00)
225#define MMD_NODE_IS_BLOCK(x) ((((mmd_node*)x)->type & MMD_TYPE_MASK) == 0x40)
226#define MMD_NODE_IS_TOKEN(x) ((((mmd_node*)x)->type & MMD_TOKEN_MASK) == 0x80)
241 LINE_DEF_ABBREVIATION,
249 LINE_FENCE_BACKTICK_3,
250 LINE_FENCE_BACKTICK_4,
251 LINE_FENCE_BACKTICK_5,
252 LINE_FENCE_BACKTICK_START_3,
253 LINE_FENCE_BACKTICK_START_4,
254 LINE_FENCE_BACKTICK_START_5,
263 LINE_LIST_ENUMERATED,
271 LINE_TABLE_SEPARATOR,
275 CODE_FENCE_LINE = 63,
278 BLOCK_BLOCKQUOTE = 64,
281 BLOCK_DEF_ABBREVIATION,
300 BLOCK_LIST_BULLETED_LOOSE,
301 BLOCK_LIST_ENUMERATED,
302 BLOCK_LIST_ENUMERATED_LOOSE,
304 BLOCK_LIST_ITEM_TIGHT,
322 TOKEN_TEXT_ABBREVIATION,
324 TOKEN_TEXT_WHITESPACE,
327 TOKEN_AMPERSAND_LONG,
336 TEXT_NUMBER_POSS_LIST,
342 TOKEN_BLOCKQUOTE_MARKER,
345 TOKEN_ABBREVIATION_MARKER,
346 TOKEN_FOOTNOTE_MARKER,
347 TOKEN_GLOSSARY_MARKER,
348 TOKEN_CITATION_MARKER,
349 TOKEN_VARIABLE_MARKER,
355 TOKEN_QUOTE_DOUBLE_ALT,
374 TOKEN_PAIR_BRACKET_EMPTY,
375 TOKEN_PAIR_BRACKET_NOT_CITED,
376 TOKEN_PAIR_BRACKET_ABBREVIATION,
377 TOKEN_PAIR_BRACKET_FOOTNOTE,
378 TOKEN_PAIR_BRACKET_GLOSSARY,
379 TOKEN_PAIR_BRACKET_CITATION,
380 TOKEN_PAIR_BRACKET_IMAGE,
381 TOKEN_PAIR_BRACKET_LINK,
382 TOKEN_PAIR_BRACKET_VARIABLE,
384 TOKEN_PAIR_QUOTE_DOUBLE,
385 TOKEN_PAIR_QUOTE_SINGLE,
387 TOKEN_PAIR_STAR_USED,
390 TOKEN_SPECIAL_CHARACTER,
395 TOKEN_ESCAPED_CHARACTER,
413 TOKEN_PAIR_CM_SUB_DEL,
414 TOKEN_PAIR_CM_SUB_ADD,
421 TOKEN_MATH_PAREN_OPEN,
422 TOKEN_MATH_PAREN_CLOSE,
423 TOKEN_MATH_BRACKET_OPEN,
424 TOKEN_MATH_BRACKET_CLOSE,
425 TOKEN_MATH_DOLLAR_SINGLE,
426 TOKEN_MATH_DOLLAR_DOUBLE,
428 TOKEN_PAIR_MATH_PAREN,
429 TOKEN_PAIR_MATH_BRACKET,
430 TOKEN_PAIR_MATH_DOLLAR_SINGLE,
431 TOKEN_PAIR_MATH_DOLLAR_DOUBLE,
438 OBJECT_REPLACEMENT_CHARACTER,
char * mmd_process_file_to_str(FILE *in, size_t *out_len, uint32_t options, const char *search_path, const char *source_path)
void mmd_process_file(FILE *in, FILE *out, uint32_t options, const char *search_path, const char *source_path)
@ MMD_OPTION_CRITIC_REJECT
Reject all proposed changes.
@ MMD_OPTION_RANDOM_NOTE_ID
Use random footnote id # to avoid collisions.
@ MMD_OPTION_TRANSCLUDE
Enable file transclusion.
@ MMD_OPTION_MMD_HEADER
Enable use of mmd header and mmd footer metadata.
@ MMD_OPTION_COMPATIBILITY
Limit functionality to core Markdown features.
@ MMD_OPTION_BLOCKS_ONLY
Process block-level tokens only; do not parse inside the blocks.
@ MMD_OPTION_RANDOM_HEADER_ID
Use random header id # to avoid collisions.
@ MMD_OPTION_STATS
Display performance stats on stderr.
@ MMD_OPTION_CRITIC_ACCEPT
Accept all proposed changes.
void mmd_node_free(mmd_node *n)
Utility functions.
void mmd_ast_file(FILE *in, FILE *out, uint32_t options)
mmd_node * mmd_parse_file(FILE *in, read_ctx *c, uint32_t options)
void mmd_node_tree_describe_hash(mmd_node *n, FILE *out)
Print node tree hash values to designated file stream.
read_ctx * read_ctx_new(uint32_t options)
read_ctx management
@ LANGUAGE_SV
Swedish language markup.
@ LANGUAGE_DE
German language markup.
@ LANGUAGE_NL
Dutch language markup.
@ LANGUAGE_ES
Spanish language markup.
@ LANGUAGE_EN
English language markup.
@ LANGUAGE_HE
Hebrew language markup.
@ LANGUAGE_FR
French language markup.
uint32_t mmd_hash_node(mmd_node *n)
Calculate hash value for individual node (and it's children)
node_types
AST node types.
uint32_t mmd_hash_node_tree(mmd_node *n)
Calculate hash values for AST (and return overall hash value)
@ QUOTES_DUTCH
Dutch smart quotes.
@ QUOTES_ENGLISH
English smart quotes.
@ QUOTES_GERMAN_GUILLEMETS
German guillemets smart quotes.
@ QUOTES_FRENCH
French smart quotes.
@ QUOTES_GERMAN
German smart quotes.
@ QUOTES_SWEDISH
Swedish smart quotes.
@ QUOTES_SPANISH
Spanish smart quotes.
@ FORMAT_LATEX
LaTeX to generate PDF.
@ FORMAT_MMD
Raw MultiMarkdown source text.
read_ctx * mmd_metadata_filename(const char *fname, uint32_t options)
Line nodes are used specifically for parsing individual lines of text into the block structure.
mmd_node general
mmd_line_node starts with regular mmd_node
size_t c_start
Starting offset (in bytes) for line content (excluding line level markup)
size_t c_len
Byte length for content of the line (excluding line level markup)
Nodes are used to build the AST during parsing.
size_t start
Starting offset (in bytes) in the source text for this node.
struct mmd_node * content
If node was parsed into span-level content, place it here.
struct mmd_node * next
Pointer to next node in the AST.
struct mmd_node * tail
Pointer to last sibling node in the AST.
size_t len
Byte length in the source text for this node.
unsigned char type
type for this node
struct mmd_node * child
Pointer to first child node in the AST.
uint32_t hash
hash for the node, useful when comparing two parse trees for similar branches