From 1952741afae6aff2d1b163233e2b39678339ff7d Mon Sep 17 00:00:00 2001 From: abap34 Date: Thu, 20 Jun 2024 15:16:02 +0900 Subject: [PATCH] =?UTF-8?q?`md=5Fto=5Fhtml`=20=E3=81=AE=E3=81=BF=E3=82=92?= =?UTF-8?q?=E6=8F=90=E4=BE=9B=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pyalmo.cpp | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/pyalmo.cpp b/src/pyalmo.cpp index 816d32c..2bebe2e 100644 --- a/src/pyalmo.cpp +++ b/src/pyalmo.cpp @@ -4,21 +4,11 @@ #include "almo.cpp" -std::string md_to_html(std::string md_content, std::map meta_data) { - almo::Block ast = almo::parse_rest(split(md_content, "\n")); - return ast.render(meta_data); -} - - -std::string md_to_json(std::string md_content) { - almo::Block ast = almo::parse_rest(split(md_content, "\n")); - return ast.to_json(); -} - - -std::string md_to_dot(std::string md_content) { - almo::Block ast = almo::parse_rest(split(md_content, "\n")); - return ast.to_dot(true); +std::string md_to_html(std::vector md_content, std::map meta_data) { + almo::Markdown ast; + almo::MarkdownParser parser(md_content, meta_data); + parser.process(ast); + return ast.to_html(); } @@ -28,10 +18,7 @@ namespace py = pybind11; PYBIND11_MODULE(almo, m) { m.doc() = "almo interface for python."; - m.def("md_to_html", &md_to_html, "md to html"); - m.def("md_to_json", &md_to_json, "md to json"); - m.def("md_to_dot", &md_to_dot, "md to dot"); - + m.def("md_to_html", &md_to_html, "Convert markdown to html."); #ifdef VERSION_INFO m.attr("__version__") = VERSION_INFO;