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

脚注中的数学公式不能正确渲染 #6

Closed
wafer-li opened this issue Jan 15, 2018 · 17 comments
Closed

脚注中的数学公式不能正确渲染 #6

wafer-li opened this issue Jan 15, 2018 · 17 comments
Labels

Comments

@wafer-li
Copy link

image

但是使用 node 的 REPL 运行 markdown-it 再加上两个插件是能够渲染出来的。

image

@wafer-li
Copy link
Author

package.json 信息:

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {
    "markdown-it": "^8.4.0",
    "markdown-it-footnote": "^3.0.1",
    "markdown-it-katex": "^2.0.3"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

node REPL 重现步骤:

var md = require('markdown-it')()
var tex = require('markdown-it-katex')
var foot = require('markdown-it-footnote')

md.use(tex)
md.use(foot)

md.render('$a+b$')
md.render('hehe[^1]\n[^1]: asddasjhf')
md.render('hehe[^1]\n[^1]: $a+b$')

@wafer-li
Copy link
Author

wafer-li commented Jan 15, 2018

md 原始文档

footnote[^1]

[^1]: $a+b$

相关的目录结构
image

同时尝试了更新 markdown-it 到最新版本也未能解决。

@CHENXCHEN
Copy link
Owner

使用该插件在本地测试,结果是有渲染正常的。
如下图:
image

image

@wafer-li
Copy link
Author

不是 hexo-all-minifier 的原因

image

image

是我哪里配置错了吗? 

@CHENXCHEN
Copy link
Owner

  1. 可以把 hexopackage.json 贴出来吗?
  2. _config.yml 中的配置看起来没有问题

@wafer-li
Copy link
Author

wafer-li commented Jan 15, 2018

{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "hexo": {
    "version": "3.4.4"
  },
  "dependencies": {
    "hexo": "^3.4.4",
    "hexo-all-minifier": "^0.4.1",
    "hexo-deployer-git": "^0.3.1",
    "hexo-filter-plantuml": "^1.0.1",
    "hexo-generator-archive": "^0.1.5",
    "hexo-generator-atom-markdown-writer-meta": "^0.1.1",
    "hexo-generator-category": "^0.1.3",
    "hexo-generator-feed": "^1.2.0",
    "hexo-generator-index": "^0.2.0",
    "hexo-generator-searchdb": "^1.0.8",
    "hexo-generator-seo-friendly-sitemap": "0.0.21",
    "hexo-generator-tag": "^0.2.0",
    "hexo-inject": "^1.0.0",
    "hexo-reference": "^1.0.3",
    "hexo-renderer-ejs": "^0.3.1",
    "hexo-renderer-markdown-it-plus": "^1.0.2",
    "hexo-renderer-stylus": "^0.3.1",
    "hexo-server": "^0.3.1",
    "hexo-symbols-count-time": "^0.2.0",
    "markdown-it-task-lists": "^2.1.0"
  }
}
不是这个插件的原因。

@CHENXCHEN
Copy link
Owner

可以将 _config.yml 中完整的内容贴下吗? 当然一些隐秘的比如密钥链接之类的可以删去

@CHENXCHEN
Copy link
Owner

我创建个 demo 项目供你参考下吧。。几分钟

@wafer-li
Copy link
Author

wafer-li commented Jan 15, 2018

好的。不过我使用的是 Data File 里面的 config。

目前 Hexo 可以在生成和部署的时候自定义 config 文件。

具体来说就是把根目录的 config 和主题里面的 config 合在一起,然后这个新的 config 会优先读取。

我的配置文件在这里 https://pastebin.com/2fL1gdxM

@CHENXCHEN
Copy link
Owner

尝试下将 50~51 行的 true 改为 false

@wafer-li
Copy link
Author

不行
image

image

@wafer-li
Copy link
Author

wafer-li commented Jan 15, 2018 via email

@CHENXCHEN
Copy link
Owner

参考 hexo-blog-demo

@wafer-li
Copy link
Author

好的,我回去研究一下。

@wafer-li
Copy link
Author

修好了,估计是我之前的配置写的有毒。

目前是把所有的自定义配置都写在原来的下面,然后就没问题了。

给一个 diff 参考一下:

https://github.com/wafer-li/wafer-li.github.io/pull/3/files#diff-b0ca4ccbaf3d7058b5a8d76a7c67eee1

@wafer-li
Copy link
Author

我建议你赶紧把 demo 删掉……
https://github.com/CHENXCHEN/hexo-blog-demo/blob/master/themes/next/_config.yml#L426

leancloud 目前好像有安全风险。
theme-next/hexo-theme-next#25

@CHENXCHEN
Copy link
Owner

Thanks

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

No branches or pull requests

2 participants