Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我想请问 公式怎么能匹配 \( \) 这种的行内和块级公式 #303

Open
Zeeyuann opened this issue Nov 7, 2024 · 1 comment
Open

Comments

@Zeeyuann
Copy link

Zeeyuann commented Nov 7, 2024

No description provided.

@chenqiuling
Copy link

方法一:简单粗暴,用正则匹配替换成所需格式,行内$latex$或者块级$$latex$$

str.replace(/\\\(\s*(.*?)\s*\\\)/g, "$$$1$$") // 行公式规则转换
    .replace(/\\\[\s*(.*?)\s*\\\]/g, "$$$$$1$$$$") // 块公式规则转换

方法二:
改源码这里的匹配逻辑 towxml/parse/markdown/plugins/latex.js
会涉及到转义字符,还需要改移动的步数

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants