next-theme / hexo-theme-next

🎉 Elegant and powerful theme for Hexo.
https://theme-next.js.org
Other
2.46k stars 436 forks source link

hexo 7, next 18.19.1代码无法高亮 #741

Closed JarmoHu closed 11 months ago

JarmoHu commented 11 months ago

Issue Checklist

Expected behavior

代码可以高亮

Actual behavior

不用next主题代码可以高亮,用了就不行。 demo: https://blog-2bl.pages.dev/posts/workers-jsdeliver#more 全部源文件:hexo-next.zip

Steps to reproduce the behavior

主题设置为next,就hexo cl然后hexo s就行了

Node.js and NPM Information

> node -v
v18.19.0
> npm -v
10.2.3

Package dependencies Information

(base) PS E:\Projects\GitBook\hexo-next> npm ls --depth 0
hexo-site@0.0.0 E:\Projects\GitBook\hexo-next
+-- hexo-generator-archive@2.0.0
+-- hexo-generator-baidu-sitemap@0.1.9
+-- hexo-generator-category@2.0.0
+-- hexo-generator-feed@3.0.0
+-- hexo-generator-index@3.0.0
+-- hexo-generator-searchdb@1.4.1
+-- hexo-generator-sitemap@3.0.1
+-- hexo-generator-tag@2.0.0
+-- hexo-optimize@3.3.0
+-- hexo-pangu@0.2.2
+-- hexo-renderer-ejs@2.0.0
+-- hexo-renderer-marked@6.2.0
+-- hexo-renderer-stylus@3.0.0
+-- hexo-server@3.0.0
+-- hexo-theme-landscape@1.0.0
+-- hexo-theme-next@8.19.1
+-- hexo-word-counter@0.1.0
`-- hexo@7.0.0

Hexo Configuration

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

# Site
title: "Jarmo's Blog"
subtitle: '人生总要做点什么吧'
description: '意义是自己赋予的'
keywords: 光学,光学工程,纳米光子学,逆向设计,光计算,硅光,光电子,硅基光电子,芯片,纳米技术,光刻,科研,华中科技大学,波导,通信,光通信
author: Jarmo Hu
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://www.430074.xyz
permalink: /posts/:title.html
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: prismjs
highlight:
  enable: false
  line_number: true
  auto_detect: true
  tab_replace: ''
  wrap: true
  hljs: false
prismjs:
  preprocess: true
  line_number: true
  tab_replace: ''

# 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: ''
symbols_count_time:
  symbols: true
  time: true
  total_symbols: true
  total_time: true
  awl: 4
  wpm: 275
search:
  path: search.xml
  field: post
  content: true
  format: html

baidusitemap:
    path: baidusitemap.xml
sitemap:
    path: sitemap.xml
filter_optimize:
  enable: true
  # static resource versioning
  versioning: false
  css:
    # minify all css files
    minify: true
    excludes:
    # use preload to load css elements dynamically
    delivery:
      - '@fortawesome/fontawesome-free'
      - 'fonts.googleapis.com'
    # make specific css content inline into the html page
    inlines:
      # support full path only
      - css/main.css
  js:
    # minify all js files
    minify: true
    excludes:
    # remove the comments in each of the js files
    remove_comments: false
  html:
    # minify all html files
    minify: true
    excludes:
  # set the priority of this plugin,
  # lower means it will be executed first, default of Hexo is 10
  priority: 12

NexT Configuration

scheme: Gemini

# Dark Mode
darkmode: false

pjax: true

# FancyBox is a tool that offers a nice and elegant way to add zooming functionality for images.
# For more information: https://fancyapps.com/fancybox/
fancybox: true

# Medium Zoom is a JavaScript library for zooming images like Medium.
# Warning: Do not enable both `fancybox` and `mediumzoom`.
# For more information: https://medium-zoom.francoischalifour.com
mediumzoom: false

# Vanilla JavaScript plugin for lazyloading images.
# For more information: https://apoorv.pro/lozad.js/demo/
lazyload: true

# Automatically insert whitespace between CJK and half-width characters.
# For more information: https://github.com/vinta/pangu.js
# Server-side plugin: https://github.com/next-theme/hexo-pangu
pangu: true

Other Information

No response

welcome[bot] commented 11 months ago

Thanks for opening this issue, maintainers will get back to you as soon as possible!

stevenjoezhang commented 11 months ago

谢谢反馈,应该修复了: https://github.com/next-theme/hexo-theme-next/commit/269eae34c415bc253cefb2cb7b409127a7de944e 如果你没有对主题代码做过自定义的话,可以重新安装github上的最新版本看看有没有问题

npm i next-theme/hexo-theme-next
JarmoHu commented 11 months ago

谢谢反馈,应该修复了: 269eae3 如果你没有对主题代码做过自定义的话,可以重新安装github上的最新版本看看有没有问题

npm i next-theme/hexo-theme-next

问题已修复,感谢。

yunnysunny commented 5 months ago

将代码高亮切换为prismjs,高亮会消失,切换为highlight可以显示高亮 next版本 8.20.0 hexo 版本 7.2.0

stevenjoezhang commented 5 months ago

@yunnysunny 新版Hexo设置代码高亮的语法变成这样了:

syntax_highlighter: prismjs

(这样设计是为了允许第三方插件开发highlight和prismjs之外的代码高亮引擎) 可以检查一下是不是这个设置的问题