Skip to content

打开多语言功能可能会导致katex渲染不正确 #929

@wbwblog

Description

@wbwblog

Issue Checklist

Expected behavior

渲染katex

Actual behavior

在只有中文页面时无法渲染katex,但是加载了katex

Steps to reproduce the behavior

设置 language_switcher: true,并 language: zh-CN

Node.js and NPM Information

Run actions/setup-node@v4
  with:
    node-version: 22
    always-auth: false
    check-latest: false
    token: ***
Found in cache @ /opt/hostedtoolcache/node/22.20.0/x64
Environment details
  node: v22.20.0
  npm: 10.9.3
  yarn: 1.22.22

Package dependencies Information

{
  "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.3.0"
  },
  "dependencies": {
    "anchor-js": "^5.0.0",
    "css-select": "^5.1.0",
    "hexo": "^7.0.0",
    "hexo-admonition": "^1.1.2",
    "hexo-deployer-git": "^4.0.0",
    "hexo-generator-archive": "^2.0.0",
    "hexo-generator-calendar": "github:theme-next/theme-next-calendar",
    "hexo-generator-category": "^2.0.0",
    "hexo-generator-index": "^3.0.0",
    "hexo-generator-searchdb": "^1.5.0",
    "hexo-generator-tag": "^2.0.0",
    "hexo-next-darkmode": "^0.1.11",
    "hexo-next-giscus": "^1.3.0",
    "hexo-next-subtitle-typing": "github:next-theme/hexo-next-subtitle-typing",
    "hexo-next-title": "github:theme-next/hexo-next-title",
    "hexo-renderer-ejs": "^2.0.0",
    "hexo-renderer-kramed": "^0.1.4",
    "hexo-renderer-markdown-it": "^7.1.1",
    "hexo-renderer-markdown-it-plus": "^1.0.6",
    "hexo-renderer-mathjax": "^0.6.0",
    "hexo-renderer-stylus": "^3.0.0",
    "hexo-server": "^3.0.0",
    "hexo-tag-details": "^0.1.7",
    "hexo-theme-landscape": "^1.0.0",
    "hexo-theme-next": "^8.23.0",
    "hexo-theme-next-anchor": "github:theme-next/hexo-theme-next-anchor",
    "hexo-word-counter": "^0.2.0",
    "lodash.assignin": "^4.2.0",
    "markdown-it-katex": "^2.0.3",
    "nvm": "^0.0.4",
    "hexo-related-posts": "^1.6.2"
  }
}

Hexo Configuration

# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site
title: wbw121124's blog
subtitle: wbw121124的博客
description: ''
keywords:
author: wbw121124
language: zh-CN
timezone: 'Asia/Shanghai'

# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: https://wbwblog.github.io/
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
  trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
  trailing_html: true # Set to false to remove trailing '.html' from permalinks

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link:
  enable: true # Open external links in new tab
  field: site # Apply to the whole site
  exclude: ''
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
syntax_highlighter: highlight.js
highlight:
  enable: true
  line_number: true
  auto_detect: true
  tab_replace:
prismjs:
  preprocess: true
  line_number: true
  tab_replace: ''
# 使用了codemirror替换了highlight.js,代码高亮更加完善,也更接近IDE的高亮样式
# 默认已经填入了一些语言的mode支持,如果你需要其他语言的支持,请查看codemirror官网的mode
# modes文档请看: https://codemirror.net/mode/
# codemirror官网: https://codemirror.net/
# 默认支持了:JS, HTML, CSS, PHP, JAVA, C, C#, C++, SHELL, PYTHON.
# codemirror:
    # modes: [ 'javascript', 'css', 'xml', 'htmlmixed', 'clike', 'php', 'shell', 'python' ]
# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:
  path: ''
  per_page: 10
  order_by: -date

# Category & Tag
default_category: uncategorized
category_map:
tag_map:

# Metadata elements
## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
meta_generator: true

# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss
## updated_option supports 'mtime', 'date', 'empty'
updated_option: 'mtime'

# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page

# Include / Exclude file(s)
## include:/exclude: options only apply to the 'source/' folder
include:
exclude:
ignore:

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next

# # Deployment
# ## Docs: https://hexo.io/docs/one-command-deployment
# deploy:
#   type: ''

# hexo-admin authentification
# admin:
#   username: wbw121124
#   password_hash: $2a$10$ngGFI38N.WZ9blLywmdMpOqTWM4exw9ONNVSBr56IeNwHyyUMOEnq
#   secret: my super secret phrase

mathjax: true

symbols_count_time:
  symbols: true
  time: true
  total_symbols: true
  total_time: true
  exclude_codeblock: false
  wpm: 275
  suffix: "mins."

subtitle_typing:
  enable: true
  typing_speed: 50
  deleting_speed: 10
  pause_before_delete: 1000
  pause_before_type: 50
  subtitles:
    - Welcome to my blog
    - Enjoy your stay
    - Have a great day!
    - Where there is a will, there is a way.
		- Hope for the best, plan for the worst.
		- Wisdom is more precious than wealth.
		- Action speaks louder than words.
		- Time and tide wait for no man.
		- Experience is the best teacher.
		- All that glitters is not gold.
		- Failure is the mother of success.
		- A journey of a thousand miles begins with a single step.
		- The early bird catches the worm.
		- Nothing is impossible to a willing heart.
		- Don't put off till tomorrow what you can do today.
		- Every cloud has a silver lining.
		- Haste makes waste.
		- Better late than never.
		- Honesty is the best policy.
		- Live and learn.
		- Health is wealth.
		- First impressions are the most lasting.
		- One man's meat is another man's poison.
		- A friend in need is a friend indeed.
		- Life is not all roses.
		- Think twice before you act.
		- Pride goes before a fall.
		- Two heads are better than one.
		- Well begun is half done.
		- To be, or not to be, that is the question.
		- Action speak louder than words.
		- An idle youth,a needy age.
		- All is well that ends well.
		- Misfortune is a good teacher.
		- Faith can move mountains.
		- He that promises too much means nothing.
		- He would climb the ladder must begin at the bottom.
		- If you are not inside a house, you don not know about its leaking.
		- It is never too late to mend.
		- Yesterday will not be called again.
		- Men will die for wealth, as bird for food.
		- Success belongs to the persevering.
		- The man who has made up his mind to win will never say \impossible\.
		- Nothing venture, nothing have.
		- If you fail, don't forget to learn your lesson.
		- No pain, no gain
		- We can only move forward, forward, by any means necessary to move forward.
		- Your fearlessness comes from ignorance.
		- Intelligence lies in diligence, and genius in accumulation.
		- Never be satisfied with learning; never be tired of teaching.
		- Books are the ladder of human progress.
		- An inch of time is an inch of gold, but you can't buy time with gold.

# 分类归档
category_generator:
  per_page: 10               # 每页显示文章数
  order_by: -date            # 按日期降序排列

# 标签归档
tag_generator:
  per_page: 10
  order_by: -date

search:
  path: search.xml  # 搜索索引文件路径
  field: post       # 搜索范围 (post/page/all)
  format: html      # 去除 HTML 标签
  limit: 10000      # 最大索引文章数

deploy:
  type: git
  # repo: 
  repo: https://github.com/wbwblog/wbwblog.github.io
  # example, https://github.com/hexojs/hexojs.github.io
  branch: main
  message: "update blog"
  ignore_error: true

# Change title and favicon when window is hidden and visible.
title_change:
  enable: true

  # Enabling this feature on non-desktop devices may not be a good choice, but it depends on you.
  onmobile: true

  # Enable random title or not.
  # Basically `random: true` means you have several titles to display and `random: false` means you have only one title to display.
  # When `random: true`, YOU MUST FOLLOW the format which has been commented in two title options below.
  # When `random: false`, please fill in the same line of the title option, like `title: one title`.
  random: false

  # Restore the original title after the specified time in milliseconds.
  timeout: 2000

  # Options when window is hidden.
  hidden:
    favicon: /logo/logo/favicon.svg
    title: hiding | wbw121124\'s Blog
      #- 404
      #- φ(* ̄0 ̄)
      #- Waiting for you.

  # Options when window is visible.
  visible:
    favicon: /logo/logo/favicon.svg
    title: welcome back to wbw121124\'s Blog
      #- 200
      #- (✿◡‿◡)
      #- Welcome back!

anchor:
  enable: false
  color: '#0e83cd'
  position: right # If left, anchors will always be visible.
  margin: 7px 
  text: ''
  icon:
    # If true, the `text` option will be ignored.
    enable: true 
    # By default, NexT has built-in FontAwesome support.
    # This option means `font-family: FontAwesome`, so DO Not change it.
    # Also you can choose ForkAwesome, but that's another story.
    font: FontAwesome
    content: \f0c1 # CSS content for FontAwesome & ForkAwesome.

NexT Configuration

# Define custom file paths.
# Create your custom files in site directory `source/_data` and uncomment needed files below.
custom_file_path:
  head: source/_data/head.njk
  # header: source/_data/header.njk
  # sidebar: source/_data/sidebar.njk
  # postMeta: source/_data/post-meta.njk
  # postBodyStart: source/_data/post-body-start.njk
  # postBodyEnd: source/_data/post-body-end.njk
  footer: source/_data/footer.njk
  # bodyEnd: source/_data/body-end.njk/
  # variable: source/_data/variables.styl
  # mixin: source/_data/mixins.styl
  # style: source/_data/styles.styl
  # js: source/js/pen.js

darkmode: true

# Show multilingual switcher in footer.
language_switcher: true

# If true, site-subtitle will be added to the title of index page.
# Remember to set up your site-subtitle in Hexo `_config.yml` (e.g. subtitle: Subtitle)
index_with_subtitle: true

# Automatically add external URL with Base64 encrypt & decrypt.
exturl: false
# If true, an icon will be attached to each external URL
exturl_icon: true

Other Information

win11 edge(版本 141.0.3537.57 (正式版本) (64 位))

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions