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

标题问题 #1061

Open
kamaitaching opened this issue Feb 5, 2024 · 4 comments
Open

标题问题 #1061

kamaitaching opened this issue Feb 5, 2024 · 4 comments

Comments

@kamaitaching
Copy link

使用一级标题写的md文件,生成之后,在页面目录点击一级标题自动跳转到文章页首了,怎么才能让他跳转到指定页面

@jinghu-moon
Copy link

jinghu-moon commented Mar 3, 2024

如果你参考主题配置文档 「LaTeX 数学公式」部分,将公式引擎更换为 katex,并执行了以下代码。

npm uninstall hexo-renderer-marked --save
npm install hexo-renderer-markdown-it --save
npm install @traptitech/markdown-it-katex --save

你只需要将上述代码反过来执行,如下:

npm install hexo-renderer-marked --save
npm uninstall hexo-renderer-markdown-it --save
npm uninstall @traptitech/markdown-it-katex --save

然后就可以在页面目录点击任意一级标题时,跳转到对应位置。

至于公式引擎可以使用 mathjax。

@milong26
Copy link

milong26 commented Mar 6, 2024

+1我也有这个问题,用的是新hexo库,我也用了katex,不太希望换成mathjax
f12检查了一下,目录超链接都是href="#"

@jinghu-moon
Copy link

补充一下,我的博客 package.json 如下:

{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "build": "hexo generate",
    "clean": "hexo clean",
    "deploy": "hexo deploy",
    "server": "hexo server"
  },
  "hexo": {
    "version": "7.0.0"
  },
  "dependencies": {
    "@traptitech/markdown-it-katex": "^3.6.0",
    "hexo": "^7.0.0",
    "hexo-abbrlink": "^2.2.1",
    "hexo-browsersync": "^0.3.0",
    "hexo-deployer-git": "^4.0.0",
    "hexo-filter-nofollow": "^2.0.2",
    "hexo-generator-archive": "^2.0.0",
    "hexo-generator-category": "^2.0.0",
    "hexo-generator-index": "^3.0.0",
    "hexo-generator-tag": "^2.0.0",
    "hexo-hash": "^1.0.4",
    "hexo-renderer-ejs": "^2.0.0",
    "hexo-renderer-markdown-it": "^7.1.0",
    "hexo-renderer-stylus": "^3.0.0",
    "hexo-server": "^3.0.0",
    "hexo-theme-landscape": "^1.0.0"
  },
  "devDependencies": {
    "gulp": "^4.0.2",
    "gulp-clean-css": "^4.3.0",
    "gulp-html-minifier-terser": "^7.1.0",
    "gulp-run-command": "^0.0.10",
    "gulp-terser": "^2.1.0"
  }
}

@Nanchengjiumeng123
Copy link

确实是这个问题,可以可以额,解决了;

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

4 participants