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

不支持用\\或\\\\换行 #15

Closed
qianbinbin opened this issue May 8, 2020 · 4 comments
Closed

不支持用\\或\\\\换行 #15

qianbinbin opened this issue May 8, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@qianbinbin
Copy link

使用 \\\\\\ 无法换行,hexo-renderer-marked / hexo-renderer-pandoc / hexo-renderer-kramed 都不行,使用的主题是 cactus。如果用 \\\ 的话会显示一个空格。
但是换成 hexo-renderer-mathjax + hexo-renderer-kramed / hexo-renderer-pandoc 就可以。不太懂前端,不知道什么原因。

@stevenjoezhang
Copy link
Member

嗯,这是 MathJax 的已知问题,解决方案见: mathjax/MathJax#2312

@qianbinbin
Copy link
Author

谢谢。看来是 mathjax v3 还不支持,我看了下 hexo-renderer-mathjax 里的地址获取的是 v2。

@stevenjoezhang
Copy link
Member

stevenjoezhang commented May 9, 2020

可以使用升级到 MathJax 3 之前的版本,例如

npm i hexo-filter-mathjax@0.2.0

旧版可能会产生额外的空行,需要删除

function optimizeMathjax() {
	var mjpage = document.getElementsByClassName('mjpage__block');
	for (var element of mjpage) {
		var next = element.nextSibling;
		if (next && next.nodeName.toLowerCase() === 'br') {
			next.parentNode.removeChild(next);
		}
	}
}

window.addEventListener('DOMContentLoaded', optimizeMathjax);
window.addEventListener('pjax:success', optimizeMathjax);

@qianbinbin
Copy link
Author

谢谢,可以了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants