1 /*
2    mkvmerge -- utility for splicing together matroska files
3    from component media subtypes
4 
5    Distributed under the GPL v2
6    see the file COPYING for details
7    or visit https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
8 
9    Written by Moritz Bunkus <moritz@bunkus.org>.
10 */
11 
12 #include "common/common_pch.h"
13 
14 #if defined(HAVE_CMARK)
15 
16 # include <cmark.h>
17 
18 # include "common/markdown.h"
19 
20 namespace mtx::markdown {
21 
22 std::string
to_html(std::string const & markdown_text,int options)23 to_html(std::string const &markdown_text,
24         int options) {
25   auto html = cmark_markdown_to_html(markdown_text.c_str(), markdown_text.length(), options);
26   if (!html)
27     return {};
28 
29   auto html_str = std::string{html};
30   free(html);
31 
32   return html_str;
33 }
34 
35 }
36 
37 #endif  // defined(HAVE_CMARK)
38