next-theme / hexo-theme-next

๐ŸŽ‰ Elegant and powerful theme for Hexo.
https://theme-next.js.org
Other
2.38k stars 421 forks source link

Why codeblocks cannot show code type (code language name)? #642

Closed Zhaopudark closed 1 year ago

Zhaopudark commented 1 year ago

Issue Checklist

Expected behavior

I want any code block shows the language name as many practices of Next examples, e.g.:

image

in pinlyu's post https://pinlyu.com/posts/30/๏ผŒ where the language name bash is shown on code blocks.

I do not know whether Next does not support this feature or if it is just a bug I encountered.

Actual behavior

image

Steps to reproduce the behavior

hexo clean && hexo g

Node.js and NPM Information

v20.0.0
9.6.3

Package dependencies Information

$ npm ls --depth 0
hexo-site@0.0.0 C:\Users\xxx\work\Blog
โ”œโ”€โ”€ disqusjs@3.0.2
โ”œโ”€โ”€ hexo-abbrlink@2.2.1
โ”œโ”€โ”€ hexo-algoliasearch@0.3.2
โ”œโ”€โ”€ hexo-deployer-ali-oss@1.0.0
โ”œโ”€โ”€ hexo-deployer-git@3.0.0
โ”œโ”€โ”€ hexo-generator-archive@2.0.0
โ”œโ”€โ”€ 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-hide-posts@0.2.0
โ”œโ”€โ”€ hexo-math@4.0.0
โ”œโ”€โ”€ hexo-related-posts@1.5.1
โ”œโ”€โ”€ hexo-renderer-ejs@2.0.0
โ”œโ”€โ”€ hexo-renderer-markdown-it-plus@1.0.6
โ”œโ”€โ”€ hexo-renderer-pug@3.0.0
โ”œโ”€โ”€ hexo-renderer-stylus@2.1.0
โ”œโ”€โ”€ hexo-server@3.0.0
โ”œโ”€โ”€ hexo-submit-urls-to-search-engine@2.1.0
โ”œโ”€โ”€ hexo-theme-landscape@0.0.3
โ”œโ”€โ”€ hexo-word-counter@0.1.0
โ”œโ”€โ”€ hexo-wordcount@6.0.1
โ”œโ”€โ”€ hexo@6.3.0
โ””โ”€โ”€ node-snackbar@0.1.16

Hexo Configuration

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

# Site
title: "xxxxx"
subtitle: "xxxxx"
description: "xxxx"
keywords: 
  - xx
  - xxxx
author: xx xxxx
language: # ๆŒ‡ๅฎš่ฏญ่จ€๏ผŒไผšๅฝฑๅ“ไธป้ข˜ๆ˜พ็คบ็š„่ฏญ่จ€๏ผŒๆŒ‰้œ€ไฟฎๆ”น
  - zh-CN
  - en  
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://little-train.com
#่ฎพ็ฝฎๆฐธไน…้“พๆŽฅ
permalink: posts/:abbrlink.html  # ๆญคๅค„ๅฏไปฅ่‡ชๅทฑ่ฎพ็ฝฎ๏ผŒไนŸๅฏไปฅ็›ดๆŽฅไฝฟ็”จ :/abbrlink
# 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
highlight:
  enable: true
  line_number: true
  auto_detect: true
  tab_replace: ''
  wrap: true
  hljs: false 
prismjs:
  enable: true
  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  

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

NexT Configuration

cache:
  enable: false

# Schemes
# scheme: Muse
# scheme: Mist
# scheme: Pisces
scheme: Gemini

menu:
  home: / || fa fa-home
  about: /about/ || fa fa-user
  tags: /tags/ || fa fa-tags
  categories: /categories/ || fa fa-th
  archives: /archives/ || fa fa-archive
  #schedule: /schedule/ || fa fa-calendar
  sitemap: /sitemap.xml || fa fa-sitemap
  commonweal: /404/ || fa fa-heartbeat

# Enable / Disable menu icons / item badges.
menu_settings:
  icons: true
  badges: true

social_icons:
  enable: true
  icons_only: false
  transition: true

tag_icon: true

related_posts:
  enable: true
  icon: fa fa-signs-post

mobile_layout_economy: true

codeblock:
  # Code Highlight theme
  # All available themes: https://theme-next.js.org/highlight/
  theme:
    light: default
    dark: stackoverflow-dark
  prism:
    light: prism
    dark: prism-dark
  copy_button:
    enable: true
    style: mac

index_with_subtitle: true

math:
  every_page: false
  mathjax:
    enable: true
    tags: ams
  katex:
    enable: false
    copy_tex: false

mediumzoom: true

pace:
  enable: true
  color: blue
  theme: minimal

canvas_ribbon:
  enable: true

Other Information

No response

welcome[bot] commented 1 year ago

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

stevenjoezhang commented 1 year ago

There is no such feature in theme NexT. IMHO, the language of the code is obvious according to the context.

Zhaopudark commented 1 year ago

@stevenjoezhang Thanks for the answer. I got it. It's not a bug.๐Ÿ˜

stevenjoezhang commented 2 months ago

There is another feature request opened here; feel free to join the discussion: https://github.com/next-theme/hexo-theme-next/issues/780