From 33974f1acdd16827342b31cba6b27db5030e733f Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 28 Oct 2021 17:06:06 +0300 Subject: Enable footnotes for cmark-gfm parser Also bump version constraints to 0.29.0-a.3 for libcmark-gfm* dependencies. --- mod/page.cxx | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'mod') diff --git a/mod/page.cxx b/mod/page.cxx index b9424dc..f2f1843 100644 --- a/mod/page.cxx +++ b/mod/page.cxx @@ -903,8 +903,14 @@ namespace brep { // Parse Markdown into the AST. // + // Note that the footnotes extension needs to be enabled via the + // CMARK_OPT_FOOTNOTES flag rather than the + // cmark_parser_attach_syntax_extension() function call. + // unique_ptr parser ( - cmark_parser_new (CMARK_OPT_DEFAULT | CMARK_OPT_VALIDATE_UTF8), + cmark_parser_new (CMARK_OPT_DEFAULT | + CMARK_OPT_FOOTNOTES | + CMARK_OPT_VALIDATE_UTF8), [] (cmark_parser* p) {cmark_parser_free (p);}); // Enable GitHub extensions in the parser, if requested. @@ -912,25 +918,20 @@ namespace brep if (type_ == text_type::github_mark) { auto add = [&parser] (const char* ext) - { - cmark_syntax_extension* e ( - cmark_find_syntax_extension (ext)); + { + cmark_syntax_extension* e ( + cmark_find_syntax_extension (ext)); - // Built-in extension is only expected. - // - assert (e != nullptr); + // Built-in extension is only expected. + // + assert (e != nullptr); - cmark_parser_attach_syntax_extension (parser.get (), e); - }; + cmark_parser_attach_syntax_extension (parser.get (), e); + }; add ("table"); add ("strikethrough"); add ("autolink"); - - // Somehow feels unsafe (there are some nasty warnings when - // upstream's tasklist.c is compiled), so let's disable for now. - // - // add ("tasklist"); } cmark_parser_feed (parser.get (), text_.c_str (), text_.size ()); -- cgit v1.1