<<
path:
root/public/blog.git/html/modules/cmark-gfm/lib.jai
blob: b2d4ea78fd74e71523b6fedcab5609e6895b121c
[raw]
[clear marker]
0CMARK :: #library "lib/libcmark-gfm";
3Cmark_Options :: enum #specified {
6 /** Include a `data-sourcepos` attribute on all block elements. */
9 /** Render `softbreak` elements as hard line breaks. */
12 /** `CMARK_OPT_SAFE` is defined here for API compatibility,
13 but it no longer has any effect. "Safe" mode is now the default:
14 set `CMARK_OPT_UNSAFE` to disable it.
18 /** Render raw HTML and unsafe links (`javascript:`, `vbscript:`,
19 * `file:`, and `data:`, except for `image/png`, `image/gif`,
20 * `image/jpeg`, or `image/webp` mime types). By default,
21 * raw HTML is replaced by a placeholder HTML comment. Unsafe
22 * links are replaced by empty strings.
26 /** Render `softbreak` elements as spaces. */
29 /** Legacy option (no effect). */
32 /** Validate UTF-8 in the input before parsing, replacing illegal
33 * sequences with the replacement character U+FFFD.
35 VALIDATE_UTF8 :: 1 << 9;
37 /** Convert straight quotes to curly, --- to em dashes, -- to en dashes. */
40 /** Use GitHub-style <pre lang="x"> tags for code blocks instead of <pre><code
41 * class="language-x">.
43 GITHUB_PRE_LANG :: 1 << 11;
45 /** Be liberal in interpreting inline HTML tags. */
46 LIBERAL_HTML_TAG :: 1 << 12;
48 /** Parse footnotes. */
51 /** Only parse strikethroughs if surrounded by exactly 2 tildes.
52 * Gives some compatibility with redcarpet.
54 STRIKETHROUGH_DOUBLE_TIDLE :: 1 << 14;
56 /** Use style attributes to align table cells instead of align attributes. */
57 TABLE_PREFER_STYLE_ATTRIBUTES :: 1 << 15;
59 /** Include the remainder of the info string in code blocks in
60 * a separate attribute.
62 FULL_INFO_STRING :: 1 << 16;
66markdown_to_html :: (s: string, options: Cmark_Options = .DEFAULT) -> string {
67 return to_string(cmark_markdown_to_html(to_c_string(s), s.count, xx options));
77cmark_markdown_to_html :: (s: *u8, len: int, opt: int) -> *u8 #foreign CMARK;