diff --git a/dsRag/Test/TestConvertHmtlToDocx.py b/dsRag/Test/TestConvertHmtlToDocx.py new file mode 100644 index 00000000..fc29604c --- /dev/null +++ b/dsRag/Test/TestConvertHmtlToDocx.py @@ -0,0 +1,14 @@ +import subprocess + +def markdown_to_docx_with_pandoc(md_path, docx_path): + subprocess.run([ + 'pandoc', + '-s', + md_path, + '-o', + docx_path, + '--mathml' + ], check=True) + +# 使用示例 +markdown_to_docx_with_pandoc('input.md', 'output.docx') \ No newline at end of file diff --git a/dsRag/Test/input.md b/dsRag/Test/input.md new file mode 100644 index 00000000..d0dff46f --- /dev/null +++ b/dsRag/Test/input.md @@ -0,0 +1,27 @@ +# 数学公式示例 + +## 基础公式 + +这是一个行内公式示例:$E=mc^2$ + +## 复杂公式 + +块级公式示例: + +$$\int_{-\infty}^\infty e^{-x^2} dx = \sqrt{\pi}$$ + +## 矩阵示例 + +$$\begin{pmatrix} +1 & 2 \\ +3 & 4 +\end{pmatrix}$$ + +## 方程组 + +$$ +\begin{cases} +x + y = 5 \\ +2x - y = 1 +\end{cases} +$$ \ No newline at end of file diff --git a/dsRag/Test/output.docx b/dsRag/Test/output.docx new file mode 100644 index 00000000..789f4583 Binary files /dev/null and b/dsRag/Test/output.docx differ diff --git a/dsRag/static/Latex.html b/dsRag/static/Latex.html index adec46d3..f3a86768 100644 --- a/dsRag/static/Latex.html +++ b/dsRag/static/Latex.html @@ -4,7 +4,7 @@