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

Next mist v7.0.0的代码块问题 #626

Closed
3 of 11 tasks
yltx opened this issue Feb 24, 2019 · 17 comments
Closed
3 of 11 tasks

Next mist v7.0.0的代码块问题 #626

yltx opened this issue Feb 24, 2019 · 17 comments

Comments

@yltx
Copy link

yltx commented Feb 24, 2019

I agree and want to create new issue


Expected behavior

我通过设置_config.yml让代码块高亮,显示代码块的复制按钮。

Actual behavior

实际上代码块的高亮出问题了,没有高亮,复制按钮也失败了。

Steps to reproduce the behavior

  1. 请直接查看我的网站中任意一篇代码高亮有问题的文章:

Node.js and NPM Information

node.js:
v10.15.0
npm:
6.4.1

Package dependencies Information

{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "hexo": {
    "version": "3.8.0"
  },
  "dependencies": {
    "hexo": "^3.7.0",
    "hexo-deployer-git": "^1.0.0",
    "hexo-generator-archive": "^0.1.5",
    "hexo-generator-category": "^0.1.3",
    "hexo-generator-index": "^0.2.1",
    "hexo-generator-searchdb": "^1.0.8",
    "hexo-generator-tag": "^0.2.0",
    "hexo-renderer-ejs": "^0.3.1",
    "hexo-renderer-marked": "^0.3.2",
    "hexo-renderer-stylus": "^0.3.3",
    "hexo-server": "^0.3.1"
  }
}

Hexo Information

Hexo version

hexo: 3.8.0
hexo-cli: 1.1.0
os: Windows_NT 10.0.17134 win32 x64
http_parser: 2.8.0
node: 10.15.0
v8: 6.8.275.32-node.45
uv: 1.23.2
zlib: 1.2.11
ares: 1.15.0
modules: 64
nghttp2: 1.34.0
napi: 3
openssl: 1.1.0j
icu: 62.1
unicode: 11.0
cldr: 33.1
tz: 2018e

Hexo Configuration

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

# Site
title: yltx's blog
subtitle:
description:
keywords:
author: 引领天下
language: zh-CN
timezone:

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://yoursite.com
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:

# 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: 404.html

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: true
relative_link: false
future: true
highlight:
  enable: false
  line_number: true
  auto_detect: false
  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:

# 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

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

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

# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
  type: git
  repo:
    github: git@github.com:yltx/yltx.github.io.git,master

# Search
search:
  path: search.xml
  field: post
  format: html
  limit: 10000

NexT Information

NexT Version:

  • Latest Master branch
  • Latest Release version
  • Old version

NexT Scheme:

  • All schemes
  • Muse
  • Mist
  • Pisces
  • Gemini

NexT Configuration:

1 (10).png
1 (9).png
1 (1).png
1 (2).png
1 (4).png
1 (8).png
1 (3).png
1 (7).png
1 (6).png
1 (5).png
1 (15).png
1 (12).png
1 (14).png
1 (11).png
1 (13).png
1 (16).png

因为不知道你们需要哪些代码,所以我将所有我修改的部分都截图给你们了。如果需要具体的代码,请QQ邮箱联系我:2326439151@qq.com

Other Information

没有了。之前找过一个人帮忙看一下我的blog,他说是代码高亮出了问题引起的,然而我没有找到解决的方法。

@stevenjoezhang
Copy link
Contributor

在Hexo Configuration中设置:

highlight:
  enable: true
  line_number: true
  auto_detect: true
  tab_replace:

重新执行hexo clean && hexo g && hexo s看看是否正常

@yltx

This comment has been minimized.

@stevenjoezhang
Copy link
Contributor

highlight已经有了,修改原来的,不要复制进去

@yltx
Copy link
Author

yltx commented Feb 24, 2019

@stevenjoezhang 谢谢,好了

@yltx
Copy link
Author

yltx commented Feb 24, 2019

@stevenjoezhang 另外能解释一下为什么我换了高版本的就需要修改这个吗

@stevenjoezhang
Copy link
Contributor

不客气。代码高亮这一部分的逻辑和以前是一样的,可能是升级的时候把某些设置覆盖掉了?

@yltx
Copy link
Author

yltx commented Feb 24, 2019

@stevenjoezhang 顺便问一下我添加自定义排序为什么不行:

![](搜狗截图20190224165549.png

会报错

我在\node_modules\hexo-generator-index\libgenerator.js末尾添加的代码:

posts.data = posts.data.sort(function(a, b) {
    if(a.top && b.top) {
        if(a.top == b.top) return b.date - a.date;
        else return b.top - a.top;
    }
    else if(a.top && !b.top) {
        return -1;
    }
    else if(!a.top && b.top) {
        return 1;
    }
    else return b.date - a.date;
});

@stevenjoezhang
Copy link
Contributor

置顶功能可以用npm装插件实现,不用自己造轮子。见:iissnan/hexo-theme-next#705

@yltx
Copy link
Author

yltx commented Feb 24, 2019

置顶功能可以用npm装插件实现,不用自己造轮子。见:iissnan / hexo-theme-next#705

没看懂?

@stevenjoezhang
Copy link
Contributor

stevenjoezhang commented Feb 24, 2019

你可以看看这个:https://github.com/Jacksgong/Blog/blob/d3363694827a8f9cf8127f1909dd16ff4f169342/node_modules/hexo-generator-index/lib/generator.js
我没有具体研究过#捂脸

更新: Hexo 已支持文章置顶 hexojs/hexo-generator-index#51

@yltx
Copy link
Author

yltx commented Feb 24, 2019

你可以看看这个:https//github.com/Jacksgong/Blog/blob/d3363694827a8f9cf8127f1909dd16ff4f169342/node_modules/hexo-generator-index/lib/generator.js
我没有具体研究过#捂脸

orz谢谢

可以了QAQ

@yltx yltx closed this as completed Feb 24, 2019
@yltx
Copy link
Author

yltx commented Feb 24, 2019

你可以看看这个:https://github.com/Jacksgong/Blog/blob/d3363694827a8f9cf8127f1909dd16ff4f169342/node_modules/hexo-generator-index/lib/generator.js
我没有具体研究过#捂脸

等等,好像还是不行?

@yltx
Copy link
Author

yltx commented Feb 24, 2019

还是之前的报错

@yltx yltx reopened this Feb 24, 2019
@ivan-nginx
Copy link
Member

sidebar:
  b2t: true
  ...

@yltx
Copy link
Author

yltx commented Mar 2, 2019

sidebar:
  b2t: true
  ...

什么意思啊

@maple3142
Copy link
Contributor

maple3142 commented Mar 2, 2019

@yltx https://theme-next.org/docs/theme-settings/#setting-sidebar-5
Besides, perhaps you should describe your question in English, since @ivan-nginx doesn't understand Chinese.

@yltx
Copy link
Author

yltx commented Mar 2, 2019

@yltx https://theme-next.org/docs/theme-settings/#setting-sidebar-5
Besides, perhaps you should describe your question in English, since @ivan-nginx doesn't understand Chinese.

Oh,I know.

I think I don't need any help about setting the sidebar,but I still want to thank you.

And the below is for @ivan-nginx

I can't use custom sorting right now. Can you help me?

My English is not very good, if there are any mistakes, please forgive me.

@stevenjoezhang stevenjoezhang changed the title next.mistv7.0.0的代码块问题 Next mist v7.0.0的代码块问题 May 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants