diff --git a/src/common/markdown.cpp b/src/common/markdown.cpp new file mode 100644 index 000000000..7ef7d3034 --- /dev/null +++ b/src/common/markdown.cpp @@ -0,0 +1,37 @@ +/* + mkvmerge -- utility for splicing together matroska files + from component media subtypes + + Distributed under the GPL v2 + see the file COPYING for details + or visit http://www.gnu.org/copyleft/gpl.html + + Written by Moritz Bunkus . +*/ + +#include "common/common_pch.h" + +#if defined(HAVE_CMARK) + +# include + +# include "common/markdown.h" + +namespace mtx { namespace markdown { + +std::string +to_html(std::string const &markdown_text, + int options) { + auto html = cmark_markdown_to_html(markdown_text.c_str(), markdown_text.length(), options); + if (!html) + return {}; + + auto html_str = std::string{html}; + free(html); + + return html_str; +} + +}} + +#endif // defined(HAVE_CMARK) diff --git a/src/common/markdown.h b/src/common/markdown.h new file mode 100644 index 000000000..c757a23e7 --- /dev/null +++ b/src/common/markdown.h @@ -0,0 +1,24 @@ +/* + mkvmerge -- utility for splicing together matroska files + from component media subtypes + + Distributed under the GPL v2 + see the file COPYING for details + or visit http://www.gnu.org/copyleft/gpl.html + + Written by Moritz Bunkus . +*/ + +#pragma once + +#include "common/common_pch.h" + +#if defined(HAVE_CMARK) + +namespace mtx { namespace markdown { + +std::string to_html(std::string const &markdown_text, int options = 0); + +}} + +#endif // defined(HAVE_CMARK)