githuber-md icon indicating copy to clipboard operation
githuber-md copied to clipboard

希望能改变数学公式插入方式

Open sexyxlyWAol opened this issue 5 years ago • 9 comments

当前数学公式插入需要在代码区块中插入,希望今后能如同其它markdown编辑器(比如typora等)直接通过$$$插入。当前插入方式不便于博文的存档与搬家。 若停止使用githuber-md的公式渲染而使用主题或其它渠道公式渲染会与markdown解析冲突。比如一个公式中含有两个_会被解析为斜体而非公式。感谢您提供如此优秀的插件,以上仅仅是一个小建议,感谢!

sexyxlyWAol avatar Apr 24 '20 03:04 sexyxlyWAol

如果用這個方法則必須全站都載入 katex 相關外部檔案,其它無用到 katex 的文章也會載入。WP Githuber MD 只會根據 code block 定義的語言代碼,在所需要的網頁載入相關檔案。並且方便擴充。

terrylinooo avatar Apr 24 '20 03:04 terrylinooo

我认为可以在存在$$$时暂停作markdown解析,这样也许能提高兼容性避免冲突。使用插件中的公式渲染时直接渲染公式即可,若关闭插件的公式渲染则按原样输出。再次感谢您的插件!

sexyxlyWAol avatar Apr 24 '20 04:04 sexyxlyWAol

五月份會推出一些 KaTex, MathJax 等等相關獨立的 plugin。假如您有這樣的需求,屆時推出後您使用該 plugin 並把 MD 的 KaTex 關掉達到您的需求。推出時我會再這裡留言告知。

terrylinooo avatar Apr 24 '20 04:04 terrylinooo

附议,现在在 Typora 编辑好的文章,粘贴过来提交之后发现并不一致

pluveto avatar Apr 30 '20 15:04 pluveto

目前采用简单粗暴的方法,由于本人基本不用斜体,就直接在functions.php里面写

$pattern = '/<\/?em>/';
$replacement = '_';
$html = preg_replace($pattern, $replacement, $html);

然而这样治标不治本。 如果采用WP Githuber MD提供的方式写公式块还存在与某些主题css冲突的问题。 逛Github的时候发现了一个给Parsedown增加公式支持的项目,ParsedownMath,然而WP Githuber MD使用的parsedown的版本较低,本人当前要准备期末考试也没有很多时间折腾。 希望作者大大可以考虑增加一个公式块停止解析为html的选项,直接原样输出。谢谢!

vanfantasy2333 avatar May 25 '20 02:05 vanfantasy2333

目前采用简单粗暴的方法,由于本人基本不用斜体,就直接在functions.php里面写

$pattern = '/<\/?em>/';
$replacement = '_';
$html = preg_replace($pattern, $replacement, $html);

然而这样治标不治本。 如果采用WP Githuber MD提供的方式写公式块还存在与某些主题css冲突的问题。 逛Github的时候发现了一个给Parsedown增加公式支持的项目,ParsedownMath,然而WP Githuber MD使用的parsedown的版本较低,本人当前要准备期末考试也没有很多时间折腾。 希望作者大大可以考虑增加一个公式块停止解析为html的选项,直接原样输出。谢谢!

其实我提交过一个能实现这样的 PR。不过作者没有完全采用。想自己实现的话如下操作 https://github.com/terrylinooo/githuber-md/commit/328897769ba605faf44471bea00fca0f6e0b0aab

pluveto avatar May 25 '20 03:05 pluveto

配套的 config:


<script src="//cdn.bootcss.com/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
--
  | <script type="text/x-mathjax-config">
  | MathJax.Hub.Config({
  | showProcessingMessages: false,
  | messageStyle: "none",
  | extensions: ["tex2jax.js","TeX/mediawiki-texvc.js","TeX/noUndefined.js", "TeX/autoload-all.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
  | jax: ["input/TeX", "output/output/HTML-CSS"],
  | tex2jax: {
  | inlineMath: [ ['$','$'], ["\\(","\\)"] ],
  | displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
  | skipTags: ['script', 'noscript', 'style', 'textarea', 'code'],
  | ignoreClass:"comment-content"
  | },
  | "HTML-CSS": {
  | availableFonts: ["STIX","TeX"],
  | showMathMenu: false
  | }
  | });
  | MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
  | </script>


pluveto avatar May 25 '20 03:05 pluveto

五月份會推出一些 KaTex, MathJax 等等相關獨立的 plugin。假如您有這樣的需求,屆時推出後您使用該 plugin 並把 MD 的 KaTex 關掉達到您的需求。推出時我會再這裡留言告知。

请问相关的插件是否已经可用?

howardlau1999 avatar Dec 23 '20 12:12 howardlau1999

五月份會推出一些 KaTex, MathJax 等等相關獨立的 plugin。假如您有這樣的需求,屆時推出後您使用該 plugin 並把 MD 的 KaTex 關掉達到您的需求。推出時我會再這裡留言告知。

请问相关的插件是否已经可用?

https://wordpress.org/plugins/wp-mathjax-plus/

terrylinooo avatar Dec 23 '20 13:12 terrylinooo

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 2 days.

github-actions[bot] avatar Jun 26 '23 00:06 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jun 29 '23 00:06 github-actions[bot]