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

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

Closed
3 tasks done
JarmoHu opened this issue Dec 15, 2023 · 5 comments
Closed
3 tasks done

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

JarmoHu opened this issue Dec 15, 2023 · 5 comments
Labels
Bug Something isn't working Solved
Milestone

Comments

@JarmoHu
Copy link

JarmoHu commented Dec 15, 2023

Issue Checklist

Expected behavior

代码可以高亮

Actual behavior

  • Links to demo site with this issue:
  • Links to repository or source code of the blog:
  • Screenshots:
    image

不用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

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

@JarmoHu JarmoHu added the Bug Something isn't working label Dec 15, 2023
Copy link

welcome bot commented Dec 15, 2023

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

@JarmoHu JarmoHu changed the title hexo 7 代码无法高亮 hexo 7, next 18.19.1代码无法高亮 Dec 15, 2023
@stevenjoezhang
Copy link
Member

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

npm i next-theme/hexo-theme-next

@JarmoHu
Copy link
Author

JarmoHu commented Dec 17, 2023

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

npm i next-theme/hexo-theme-next

问题已修复,感谢。

@yunnysunny
Copy link

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

@stevenjoezhang
Copy link
Member

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

syntax_highlighter: prismjs

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Solved
Projects
None yet
Development

No branches or pull requests

3 participants