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

Code Highlight error in 7.0.0-rc2 #5283

Closed
4 of 5 tasks
xihale opened this issue Aug 30, 2023 · 4 comments
Closed
4 of 5 tasks

Code Highlight error in 7.0.0-rc2 #5283

xihale opened this issue Aug 30, 2023 · 4 comments

Comments

@xihale
Copy link

xihale commented Aug 30, 2023

Check List

Please check followings before submitting a new issue.

Expected behavior

To call primejs to display the code.

Actual behavior

It called highlight.js unexpectedly.

How to reproduce?

Create a sample blog using hexo 7.0.0-rc2
And then disable the plugin highlight.js and enable primejs

highlight:
  enable: false
  line_number: true
  auto_detect: false
  tab_replace: ''
  wrap: true
  hljs: false
prismjs:
  enable: true
  preprocess: true
  line_number: false
  tab_replace: ''

as you can see, I disabled the line_number of the prismjs, but just run hexo clean && hexo s and to see the result

It displays the code with line_number using highlight.js

You can use this sample to test:

---
title: Hello World
---

{% codeblock code lang:cpp %}
#include <iostream>

int main(){

  return 0;
}
{% endcodeblock %}

Is the problem still there under "Safe mode"?

Environment & Settings

Node.js & npm version(node -v && npm -v)

v18.16.1
9.8.1

Your site _config.yml (Optional)

highlight:
  enable: false
  line_number: true
  auto_detect: false
  tab_replace: ''
  wrap: true
  hljs: false
prismjs:
  enable: true
  preprocess: true
  line_number: false
  tab_replace: ''

Hexo and Plugin version(npm ls --depth 0)

hexo-site@0.0.0 /home/xihale/桌面/learning/hexo/dev-hexo
├── ansi-sequence-parser@1.1.1 extraneous
├── debug@4.3.4 extraneous
├── he@1.2.0 extraneous
├── 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-hotreloader@0.0.3 -> ./../hexo-hotreloader
├── hexo-renderer-ejs@2.0.0
├── hexo-renderer-marked@6.1.1
├── hexo-renderer-stylus@2.1.0
├── hexo-server@3.0.0
├── hexo-shiki@0.0.6 -> ./node_modules/.store/hexo-shiki@0.0.6/node_modules/hexo-shiki
├── hexo-theme-landscape@1.0.0
├── hexo@7.0.0-rc2 invalid: "^6.3.0" from the root project
├── jsonc-parser@3.2.0 extraneous
├── ms@2.1.2 extraneous
├── shiki@0.14.3 extraneous
├── source-map@0.7.4 extraneous
├── statuses@1.5.0 extraneous
├── vscode-oniguruma@1.7.0 extraneous
└── vscode-textmate@9.0.0 extraneous

Your package.json 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-rc2"
  },
  "dependencies": {
    "hexo": "^6.3.0",
    "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-renderer-ejs": "^2.0.0",
    "hexo-renderer-marked": "^6.0.0",
    "hexo-renderer-stylus": "^2.1.0",
    "hexo-server": "^3.0.0",
    "hexo-shiki": "^0.0.6",
    "hexo-theme-landscape": "^1.0.0",
    "hexo-hotreloader": ">=0.0.1"
  }
}

Others

@D-Sketon
Copy link
Member

7.0.0 use

syntax_highlighter: 'prismjs'

to change highlighter

@xihale
Copy link
Author

xihale commented Aug 30, 2023

7.0.0 use

syntax_highlighter: 'prismjs'

to change highlighter

Thanks, I known.

@xihale xihale closed this as completed Aug 30, 2023
@prinsss
Copy link

prinsss commented Nov 7, 2023

@D-Sketon I have run into similar problem when upgrading to Hexo 7.0.0.

The configuration that I used before to disable highlight.js no longer works:

highlight:
  enable: false

To disable highlight.js in 7.0.0, it needs extra configuration.

# The default value is 'highlight.js' and here we set it to empty
syntax_highlighter:

I think this should be considered as a breaking change, and it would be reasonable to mention it in the migration guide.

cc @stevenjoezhang for #5095

@yoshinorin
Copy link
Member

@prinsss
Thank you ❤️


Does some one would you please fix a release news?

Thank you :)

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