💾 Archived View for gmi.noulin.net › gitRepositories › md2html › file › render_html.h.gmi captured on 2024-07-09 at 02:24:42. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
render_html.h (2374B)
1 /* 2 * MD4C: Markdown parser for C 3 * (http://github.com/mity/md4c) 4 * 5 * Copyright (c) 2016-2017 Martin Mitas 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a 8 * copy of this software and associated documentation files (the "Software"), 9 * to deal in the Software without restriction, including without limitation 10 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 * and/or sell copies of the Software, and to permit persons to whom the 12 * Software is furnished to do so, subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice shall be included in 15 * all copies or substantial portions of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 23 * IN THE SOFTWARE. 24 */ 25 26 #ifndef MD4C_RENDER_HTML_H 27 #define MD4C_RENDER_HTML_H 28 29 #include "shpPackages/md4c/md4c.h" 30 31 /* If set, debug output from md_parse() is sent to stderr. */ 32 #define MD_RENDER_FLAG_DEBUG 0x0001 33 #define MD_RENDER_FLAG_VERBATIM_ENTITIES 0x0002 34 35 36 /* Render Markdown into HTML. 37 * 38 * Note only contents of <body> tag is generated. Caller must generate 39 * HTML header/footer manually before/after calling md_render_html(). 40 * 41 * Params input and input_size specify the Markdown input. 42 * Callback process_output() gets called with chunks of HTML output. 43 * (Typical implementation may just output the bytes to file or append to 44 * some buffer). 45 * Param userdata is just propgated back to process_output() callback. 46 * Param parser_flags are flags from md4c.h propagated to md_parse(). 47 * Param render_flags is bitmask of MD_RENDER_FLAG_xxxx. 48 * 49 * Returns -1 on error (if md_parse() fails.) 50 * Returns 0 on success. 51 */ 52 int md_render_html(const MD_CHAR* input, MD_SIZE input_size, 53 void (*process_output)(const MD_CHAR*, MD_SIZE, void*), 54 void* userdata, unsigned parser_flags, unsigned renderer_flags); 55 56 57 #endif /* MD4C_RENDER_HTML_H */