aboutsummaryrefslogtreecommitdiff
path: root/mod/page.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-10-28 17:06:06 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-10-29 11:13:25 +0300
commit33974f1acdd16827342b31cba6b27db5030e733f (patch)
tree9e592b6c32a3149b6cbb4804aeb52f85530a7970 /mod/page.cxx
parentae93f783189aa5d10fa4399fffcdc8eee3897c04 (diff)
Enable footnotes for cmark-gfm parser
Also bump version constraints to 0.29.0-a.3 for libcmark-gfm* dependencies.
Diffstat (limited to 'mod/page.cxx')
-rw-r--r--mod/page.cxx29
1 files changed, 15 insertions, 14 deletions
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<cmark_parser, void (*)(cmark_parser*)> 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 ());