撤回了mathjax本地化
This commit is contained in:
124
.idea/workspace.xml
generated
124
.idea/workspace.xml
generated
@@ -5,18 +5,14 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="6b18b44a-df57-4212-a857-9e291ebe5dd2" name="更改" comment="">
|
<list default="true" id="6b18b44a-df57-4212-a857-9e291ebe5dd2" name="更改" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/docutranslate/static/MathJax.js" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/docutranslate/static/mermaid.js" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/docutranslate/template/__init__.py" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/docutranslate/template/markdown.html" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/docutranslate/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/__init__.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/docutranslate/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/__init__.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/docutranslate/agents/agent.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/agents/agent.py" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/docutranslate/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/app.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/docutranslate/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/app.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/docutranslate/global_values/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/global_values/__init__.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/docutranslate/static/MathJax.js" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/static/MathJax.js" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/docutranslate/static/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/static/index.html" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/docutranslate/static/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/static/index.html" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/docutranslate/template/markdown.html" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/template/markdown.html" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/docutranslate/translater.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/translater.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/docutranslate/translater.py" beforeDir="false" afterPath="$PROJECT_DIR$/docutranslate/translater.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/pyproject.toml" beforeDir="false" afterPath="$PROJECT_DIR$/pyproject.toml" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -47,62 +43,62 @@
|
|||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">{
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"DefaultHtmlFileTemplate": "HTML File",
|
"DefaultHtmlFileTemplate": "HTML File",
|
||||||
"JavaScript 调试.output.html (1).executor": "Run",
|
"JavaScript 调试.output.html (1).executor": "Run",
|
||||||
"JavaScript 调试.output.html.executor": "Run",
|
"JavaScript 调试.output.html.executor": "Run",
|
||||||
"JavaScript 调试.regex.md_中文.html.executor": "Run",
|
"JavaScript 调试.regex.md_中文.html.executor": "Run",
|
||||||
"JavaScript 调试.regex_中文.html.executor": "Run",
|
"JavaScript 调试.regex_中文.html.executor": "Run",
|
||||||
"JavaScript 调试.test.html.executor": "Run",
|
"JavaScript 调试.test.html.executor": "Run",
|
||||||
"JavaScript 调试.test2.html.executor": "Run",
|
"JavaScript 调试.test2.html.executor": "Run",
|
||||||
"JavaScript 调试.test2_英文.html.executor": "Run",
|
"JavaScript 调试.test2_英文.html.executor": "Run",
|
||||||
"JavaScript 调试.test4-1_中文.html.executor": "Run",
|
"JavaScript 调试.test4-1_中文.html.executor": "Run",
|
||||||
"JavaScript 调试.互联网认证授权机制.html.executor": "Run",
|
"JavaScript 调试.互联网认证授权机制.html.executor": "Run",
|
||||||
"JavaScript 调试.互联网认证授权机制_英文.html.executor": "Run",
|
"JavaScript 调试.互联网认证授权机制_英文.html.executor": "Run",
|
||||||
"JavaScript 调试.毕业论文_英文.html.executor": "Run",
|
"JavaScript 调试.毕业论文_英文.html.executor": "Run",
|
||||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
||||||
"Python 测试.Python 测试 (markdown_mask.py 内).executor": "Run",
|
"Python 测试.Python 测试 (markdown_mask.py 内).executor": "Run",
|
||||||
"Python 测试.markdown_mask.Test.test_basic_link_masking 的 Python 测试.executor": "Run",
|
"Python 测试.markdown_mask.Test.test_basic_link_masking 的 Python 测试.executor": "Run",
|
||||||
"Python 测试.pytest (test_html.py 内).executor": "Run",
|
"Python 测试.pytest (test_html.py 内).executor": "Run",
|
||||||
"Python.1test.executor": "Run",
|
"Python.1test.executor": "Run",
|
||||||
"Python.2test2 (1).executor": "Run",
|
"Python.2test2 (1).executor": "Run",
|
||||||
"Python.PDFtranslater (1).executor": "Run",
|
"Python.PDFtranslater (1).executor": "Run",
|
||||||
"Python.PDFtranslater (2).executor": "Run",
|
"Python.PDFtranslater (2).executor": "Run",
|
||||||
"Python.agent.executor": "Debug",
|
"Python.agent.executor": "Debug",
|
||||||
"Python.agent_utils.executor": "Run",
|
"Python.agent_utils.executor": "Run",
|
||||||
"Python.app (1).executor": "Run",
|
"Python.app (1).executor": "Run",
|
||||||
"Python.app.executor": "Run",
|
"Python.app.executor": "Run",
|
||||||
"Python.app2.executor": "Run",
|
"Python.app2.executor": "Run",
|
||||||
"Python.app_test (1).executor": "Run",
|
"Python.app_test (1).executor": "Run",
|
||||||
"Python.convert.executor": "Run",
|
"Python.convert.executor": "Run",
|
||||||
"Python.converter_docling.executor": "Run",
|
"Python.converter_docling.executor": "Run",
|
||||||
"Python.converter_mineru.executor": "Run",
|
"Python.converter_mineru.executor": "Run",
|
||||||
"Python.markdown_splitter.executor": "Debug",
|
"Python.markdown_splitter.executor": "Debug",
|
||||||
"Python.markdown_utils.executor": "Run",
|
"Python.markdown_utils.executor": "Run",
|
||||||
"Python.test.executor": "Run",
|
"Python.test.executor": "Run",
|
||||||
"Python.test1.executor": "Run",
|
"Python.test1.executor": "Run",
|
||||||
"Python.test2.executor": "Run",
|
"Python.test2.executor": "Run",
|
||||||
"Python.test3.executor": "Run",
|
"Python.test3.executor": "Run",
|
||||||
"Python.test4.executor": "Run",
|
"Python.test4.executor": "Run",
|
||||||
"Python.testhtml.executor": "Run",
|
"Python.testhtml.executor": "Run",
|
||||||
"Python.translater.executor": "Run",
|
"Python.translater.executor": "Run",
|
||||||
"Python.切分测试.executor": "Run",
|
"Python.切分测试.executor": "Run",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager": "true",
|
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager": "true",
|
||||||
"RunOnceActivity.git.unshallow": "true",
|
"RunOnceActivity.git.unshallow": "true",
|
||||||
"git-widget-placeholder": "dev",
|
"git-widget-placeholder": "main",
|
||||||
"last_opened_file_path": "C:/Users/jxgm/Desktop/translate/docutranslate",
|
"last_opened_file_path": "C:/Users/jxgm/Desktop/translate/docutranslate",
|
||||||
"list.type.of.created.stylesheet": "CSS",
|
"list.type.of.created.stylesheet": "CSS",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
"settings.editor.selected.configurable": "preferences.pluginManager",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
}</component>
|
}]]></component>
|
||||||
<component name="RecentsManager">
|
<component name="RecentsManager">
|
||||||
<key name="CopyFile.RECENT_KEYS">
|
<key name="CopyFile.RECENT_KEYS">
|
||||||
<recent name="C:\Users\jxgm\Desktop\translate\docutranslate" />
|
<recent name="C:\Users\jxgm\Desktop\translate\docutranslate" />
|
||||||
@@ -642,14 +638,14 @@
|
|||||||
<breakpoints>
|
<breakpoints>
|
||||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||||
<url>file://$PROJECT_DIR$/docutranslate/translater.py</url>
|
<url>file://$PROJECT_DIR$/docutranslate/translater.py</url>
|
||||||
<line>250</line>
|
<line>240</line>
|
||||||
<option name="timeStamp" value="2" />
|
<option name="timeStamp" value="2" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
</breakpoints>
|
</breakpoints>
|
||||||
</breakpoint-manager>
|
</breakpoint-manager>
|
||||||
</component>
|
</component>
|
||||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||||
<SUITE FILE_PATH="coverage/filetranslate$app_test__1_.coverage" NAME="app_test (1) 覆盖结果" MODIFIED="1748227675220" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" />
|
<SUITE FILE_PATH="coverage/filetranslate$app_test__1_.coverage" NAME="app_test (1) 覆盖结果" MODIFIED="1748234136289" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" />
|
||||||
<SUITE FILE_PATH="coverage/filetranslate$test.coverage" NAME="test 覆盖结果" MODIFIED="1747472297913" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" />
|
<SUITE FILE_PATH="coverage/filetranslate$test.coverage" NAME="test 覆盖结果" MODIFIED="1747472297913" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/tests" />
|
||||||
<SUITE FILE_PATH="coverage/filetranslate$convert.coverage" NAME="convert 覆盖结果" MODIFIED="1746963490689" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/docutranslate/utils" />
|
<SUITE FILE_PATH="coverage/filetranslate$convert.coverage" NAME="convert 覆盖结果" MODIFIED="1746963490689" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/docutranslate/utils" />
|
||||||
<SUITE FILE_PATH="coverage/PDFtranslate$PDFtranslater__1_.coverage" NAME="PDFtranslater (1) 覆盖结果" MODIFIED="1746633258205" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/pdftranslate_packages" />
|
<SUITE FILE_PATH="coverage/PDFtranslate$PDFtranslater__1_.coverage" NAME="PDFtranslater (1) 覆盖结果" MODIFIED="1746633258205" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/pdftranslate_packages" />
|
||||||
|
|||||||
@@ -188,7 +188,6 @@ translater = FileTranslater(base_url="<baseurl>", # 默认的模型baseurl
|
|||||||
docling_artifact=None, # 使用提前下载好的docling模型
|
docling_artifact=None, # 使用提前下载好的docling模型
|
||||||
convert_engin="mineru", # 可选minerU或docling
|
convert_engin="mineru", # 可选minerU或docling
|
||||||
mineru_token="<mineru-token>", # minerU的token,使用minerU时必填
|
mineru_token="<mineru-token>", # minerU的token,使用minerU时必填
|
||||||
tips=True # 开场提示
|
|
||||||
)
|
)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
__version__="0.2.25"
|
__version__="0.2.26"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ async def _perform_translation(params: Dict[str, Any], file_contents: bytes, ori
|
|||||||
model_id=params['model_id'],
|
model_id=params['model_id'],
|
||||||
convert_engin=params['convert_engin'],
|
convert_engin=params['convert_engin'],
|
||||||
mineru_token=params['mineru_token'],
|
mineru_token=params['mineru_token'],
|
||||||
tips=False # Assuming tips are not needed for server-side processing
|
|
||||||
)
|
)
|
||||||
await ft.translate_bytes_async(
|
await ft.translate_bytes_async(
|
||||||
name=original_filename,
|
name=original_filename,
|
||||||
@@ -376,10 +375,12 @@ async def get_logs_from_queue():
|
|||||||
async def download_markdown(filename_with_ext: str):
|
async def download_markdown(filename_with_ext: str):
|
||||||
if not current_state["download_ready"] or not current_state["markdown_content"] or not current_state[
|
if not current_state["download_ready"] or not current_state["markdown_content"] or not current_state[
|
||||||
"original_filename_stem"]:
|
"original_filename_stem"]:
|
||||||
|
print("Markdown 内容尚未准备好或不可用。")
|
||||||
raise HTTPException(status_code=404, detail="Markdown 内容尚未准备好或不可用。")
|
raise HTTPException(status_code=404, detail="Markdown 内容尚未准备好或不可用。")
|
||||||
|
|
||||||
requested_stem = Path(filename_with_ext).stem.replace("_translated", "")
|
requested_stem = Path(filename_with_ext).stem.replace("_translated", "")
|
||||||
if requested_stem != current_state["original_filename_stem"]:
|
if requested_stem != current_state["original_filename_stem"]:
|
||||||
|
print("请求的文件名与当前结果不符。")
|
||||||
raise HTTPException(status_code=404, detail="请求的文件名与当前结果不符。")
|
raise HTTPException(status_code=404, detail="请求的文件名与当前结果不符。")
|
||||||
|
|
||||||
actual_filename = f"{current_state['original_filename_stem']}_translated.md"
|
actual_filename = f"{current_state['original_filename_stem']}_translated.md"
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -699,7 +699,6 @@
|
|||||||
try {
|
try {
|
||||||
const response = await fetch("/meta")
|
const response = await fetch("/meta")
|
||||||
let meta = await response.json();
|
let meta = await response.json();
|
||||||
console.log(meta)
|
|
||||||
versionDisplay.textContent = `版本号${meta.version}`;
|
versionDisplay.textContent = `版本号${meta.version}`;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn("获取版本号失败", error);
|
console.warn("获取版本号失败", error);
|
||||||
|
|||||||
@@ -10,14 +10,24 @@
|
|||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script type="text/x-mathjax-config">
|
<script>
|
||||||
MathJax.Hub.Config({
|
MathJax = {
|
||||||
messageStyle: "none",
|
loader: {load: ['[tex]/ams']},
|
||||||
tex2jax: {
|
tex: {
|
||||||
inlineMath: [ ['$','$'], ["\\\\(","\\\\)"] ],
|
inlineMath: [['$', '$'], ['\\(', '\\)']],
|
||||||
processEscapes: true
|
displayMath: [['$$', '$$'], ['\\[', '\\]']],
|
||||||
|
processEscapes: true,
|
||||||
|
formatError: (error) => {
|
||||||
|
}, // 空函数,不显示任何错误
|
||||||
|
packages: {'[+]': ['ams']}, // 启用AMS宏包
|
||||||
|
autoload: {color: [], colorv2: ['color']} // 颜色支持
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
renderActions: {
|
||||||
|
addMenu: [0, '', '']
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
{{MathJax}}
|
{{MathJax}}
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ class FileTranslater:
|
|||||||
max_concurrent=20, timeout=2000,
|
max_concurrent=20, timeout=2000,
|
||||||
convert_engin: Literal["docling", "mineru"] = "mineru",
|
convert_engin: Literal["docling", "mineru"] = "mineru",
|
||||||
docling_artifact: Path | str | None = None,
|
docling_artifact: Path | str | None = None,
|
||||||
mineru_token: str = None,
|
mineru_token: str = None):
|
||||||
tips=True):
|
|
||||||
self.convert_engin = convert_engin
|
self.convert_engin = convert_engin
|
||||||
self.mineru_token = mineru_token.strip() if mineru_token is not None else None
|
self.mineru_token = mineru_token.strip() if mineru_token is not None else None
|
||||||
if isinstance(file_path, str):
|
if isinstance(file_path, str):
|
||||||
@@ -46,15 +45,6 @@ class FileTranslater:
|
|||||||
translater_logger.info("检测到docling_artifact文件夹")
|
translater_logger.info("检测到docling_artifact文件夹")
|
||||||
self.docling_artifact = artifact_path
|
self.docling_artifact = artifact_path
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
if tips:
|
|
||||||
print("""
|
|
||||||
=======
|
|
||||||
[docutranslate](https://github.com/xunbu/docutranslate)
|
|
||||||
>以下操作会自动从[huggingface](https://huggingface.co)下载模型,windows需要使用**管理员模式**打开IDE运行脚本,并按需换源
|
|
||||||
- 第一次使用该库读取、翻译非markdown文本
|
|
||||||
- 第一次使用该库的公式识别或代码识别功能
|
|
||||||
=======
|
|
||||||
""")
|
|
||||||
|
|
||||||
def _markdown_format(self):
|
def _markdown_format(self):
|
||||||
# 该方法还需要改进
|
# 该方法还需要改进
|
||||||
@@ -305,18 +295,20 @@ class FileTranslater:
|
|||||||
|
|
||||||
def export_to_html(self, title="title") -> str:
|
def export_to_html(self, title="title") -> str:
|
||||||
markdowner = markdown2.Markdown(extras=['tables', 'fenced-code-blocks', 'mermaid', "code-friendly"])
|
markdowner = markdown2.Markdown(extras=['tables', 'fenced-code-blocks', 'mermaid', "code-friendly"])
|
||||||
# TODO:实现完全本地化css和js
|
|
||||||
# language=html
|
# language=html
|
||||||
pico=Path(__file__).parent / "static" / "pico.css"
|
pico=Path(__file__).parent / "static" / "pico.css"
|
||||||
html = Path(__file__).parent / "template" / "markdown.html"
|
html = Path(__file__).parent / "template" / "markdown.html"
|
||||||
MathJax=Path(__file__).parent / "static" / "MathJax.js"
|
MathJax=Path(__file__).parent / "static" / "MathJax.js"
|
||||||
mermaid=Path(__file__).parent / "static" / "mermaid.js"
|
mermaid=Path(__file__).parent / "static" / "mermaid.js"
|
||||||
|
#TODO:实现MathJax本地化
|
||||||
render = jinja2.Template(html.read_text()).render(
|
render = jinja2.Template(html.read_text()).render(
|
||||||
title=title,
|
title=title,
|
||||||
pico=f"<style>{pico.read_text()}</style>",
|
pico=f"<style>\n{pico.read_text()}\n</style>",
|
||||||
|
# markdown=markdowner.convert(self.markdown),
|
||||||
markdown=markdowner.convert(self.markdown.replace("\\", "\\\\")),
|
markdown=markdowner.convert(self.markdown.replace("\\", "\\\\")),
|
||||||
MathJax=f"<script>{MathJax.read_text()}</script>",
|
MathJax=r'<script src=" https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-mml-chtml.min.js "></script>',
|
||||||
mermaid=f"<script>{mermaid.read_text()}</script>",
|
# MathJax=f'<script>\n{MathJax.read_text()}\n</script>',
|
||||||
|
mermaid=f"<script>\n{mermaid.read_text()}\n</script>",
|
||||||
)
|
)
|
||||||
return render
|
return render
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user