liuyib / hexo-theme-stun

🦄 An elegant theme for Hexo
https://theme-stun.github.io/docs/
MIT License
620 stars 125 forks source link

目录不能展开 #145

Closed YiHui-Liu closed 3 years ago

YiHui-Liu commented 3 years ago

我想创建一个新的 issue

环境信息

Stun 版本: 2.4.0

Hexo 版本: 5.2.0

平台信息: Ubuntu 20.04

浏览器信息: Chrome 87

Node.js 和 NPM 版本:

root@fox:/home/blog# node -v
v14.15.1
root@fox:/home/blog# npm -v
6.14.8

NPM 依赖信息: hexo-site@0.0.0 /home/hexo-blog ├── hexo@5.2.0 ├── hexo-browsersync@0.3.0 ├── hexo-deployer-git@2.1.0 ├── hexo-generator-archive@1.0.0 ├── hexo-generator-category@1.0.0 ├── hexo-generator-feed@3.0.0 ├── hexo-generator-index-pin-top@0.2.2 ├── hexo-generator-searchdb@1.3.3 ├── hexo-generator-sitemap@2.1.0 ├── hexo-generator-tag@1.0.0 ├── hexo-renderer-ejs@1.0.0 ├── hexo-renderer-markdown-it-plus@1.0.4 ├── hexo-renderer-pug@1.0.0 ├── hexo-renderer-stylus@2.0.1 ├── hexo-server@2.0.0 ├── hexo-wordcount@6.0.1 └── shelljs@0.8.4

Hexo 配置信息:

查看代码 ... ```yml # Hexo Configuration ## Docs: https://hexo.io/docs/configuration.html ## Source: https://github.com/hexojs/hexo/ # Site title: Fox Home subtitle: '清疚' description: 'blog of foolish fox | FF的博客' keywords: foolishfox, blog, share author: liuyihui language: zh-CN timezone: 'Asia/Shanghai' # URL ## If your site is put in a subdirectory, set url as 'http://example.com/child' and root as '/child/' url: https://foolishfox.cn root: / permalink: posts/:year:month-:id.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: :year/:month/: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: false highlight: enable: true line_number: true auto_detect: false tab_replace: '' wrap: true hljs: false prismjs: enable: false 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: landscape theme: stun # Deployment ## Docs: https://hexo.io/docs/one-command-deployment deploy: # RSS subscribe feed: type: atom path: atom.xml limit: 3 content: true # local search search: path: search.json field: post content: true ```

Stun 配置信息:

查看代码 ... ```yml # --------------------------------------------------------------- # Theme Core Configuration Settings # --------------------------------------------------------------- # Remove unnecessary files after hexo generate. shake_file: true # --------------------------------------------------------------- # SEO Settings # --------------------------------------------------------------- # If true, will add site-subtitle to index page. # Remember to set up your site-subtitle in Hexo `_config.yml`. index_subtitle: false # Set a canonical link tag for your Hexo site. # See: https://support.google.com/webmasters/answer/139066 # Remember to set up your URL in Hexo `_config.yml` (e.g. url: http://yoursite.com) canonical: true # Webmaster tools verification setting # --------------------------------------------------------------- # Google Webmaster tools verification setting # See: https://www.google.com/webmasters/ google_site_verification: # Bing Webmaster tools verification setting # See: https://www.bing.com/webmaster/ bing_site_verification: # Baidu Webmaster tools verification setting # See: https://ziyuan.baidu.com/site/ baidu_site_verification: # 360 Webmaster tools verification setting # see http://zhanzhang.so.com/ qihu360_site_verification: # Sougou Webmaster tools verification setting # see http://zhanzhang.sogou.com/ sougou_site_verification: # --------------------------------------------------------------- # Menu config # --------------------------------------------------------------- # The menu in the website header. # Value before `||` is the target link, value after `||` is the name of FontAwesome icon. # Usage(With Icon): `Key: /link/ || fa(s|r|l|d|b) fa-iconname` # Usage(No Icon) : `Key: /link/` # Select your icon name, see: https://fontawesome.com/icons menu: home: / || fas fa-home article: javascript:; || fas fa-feather-alt about: /about/ || fas fa-address-card micro_blog: /micro-blog/ || fab fa-microblog friends: /friends/ || far fa-heart lab: javascript:; || fas fa-flask # You can add a secondary menu like follow. # xxx1: javascript:; || fa(s|r|l|d|b) fa-xxx # Secondary menu submenu: # Add item of secondary menu in here. article: archives: /archives/ || fas fa-folder-open categories: /categories/ || fas fa-layer-group tags: /tags/ || fas fa-tags lab: file: https://api.foolishfox.cn/file || fas fa-file-export menu_settings: # Only show by icon. icon_only: false # Only show by text. text_only: false # --------------------------------------------------------------- # Site config # --------------------------------------------------------------- favicon: small: https://img.foolishfox.cn/images/static/fox_small.jpg medium: https://img.foolishfox.cn/images/static/fox_big.jpg # ! -------------------------------------------------- # ! If you don't know the following, please ignore it. # ! -------------------------------------------------- # apple_touch_icon: /images/icons/apple-touch-icon.png # safari_pinned_tab: /images/icons/stun-logo.svg # msapplication: /images/icons/favicon-144x144.png # Progressive Web Apps # See: https://github.com/lavas-project/hexo-pwa/ pwa: enable: false manifest: /manifest.json # (Please use "" to wrap the value) theme_color: "#54bcff" # Night mode night_mode: enable: true # The button of switching to the night mode. button: # Color of button (Please use "" to wrap the value). color: "#fafafa" # Background color of button (Please use "" to wrap the value). bg_color: "#8c8a8a" # The icon that stand for day and night. icon: dark: 🌜 light: 🌞 # The layout for sidebar and content of site. layout: # The width of the content area in website. content: 960px # The width of the sidebar in website. sidebar: 300px # The width between the content and the sidebar. content_sidebar_gap: 30px # The padding property of the main tag. # e.g. Usage: # 20px # 20px 30px # 20px 20px 30px # 20px 30px 40px 25px main_padding: # Take effect when screen width in: [768px, Infinity) default: 20px # Take effect when screen width in: [576px, 768px) tablet: 15px # Take effect when screen width in: [0px, 576px) mobile: 10px # The header of site. header: enable: true show_on: # Whether to show on the article page. post: true # If you set a percentage, it will be calculated based on the height of screen (Supports all CSS units) height: 45% # Background image of site header. bg_image: enable: false # In theme directory (source/images): /images/avatar.png # In site directory (source/uploads): /uploads/avatar.png # You can also use a link of image. url: # Mask effect of the background image. mask: enable: false # Opacity of the mask (value: 0 ~ 1) opacity: 0.5 nav: # Height of the navigation bar (Supports all CSS units) height: 50px # Background color of the navigation bar (Please use "" to wrap the value). bg_color: "#333" # The icon that prompts the user to pull down. scroll_down_icon: enable: false # Icon name in FontAwesome, see: https://fontawesome.com/icons name: fas fa-angle-down animation: true # The body of site. body: # Background image of site body. bg_image: enable: false # In theme directory (source/images): /images/avatar.png # In site directory (source/uploads): /uploads/avatar.png # You can also use a link of image. url: # Whether to fixed the background image. fixed: true # Whether to repeat the image as much as possible to cover the entire area. repeat: false # Mask effect of the background image. mask: enable: false # Opacity of mask (value: 0 ~ 1) opacity: # Opacity of the mask by default. default: 0.1 # Opacity of the mask in night mode. night_mode: 0.6 # The footer of site. footer: # Background image of site footer. bg_image: enable: false # In theme directory (source/images): /images/avatar.png # In site directory (source/uploads): /uploads/avatar.png # You can also use a link of image. url: # Mask effect of the background image. mask: enable: false # Opacity of mask (value: 0 ~ 1) opacity: 0.5 # Copyright information. copyright: enable: true # If not set, will be used `author` from Hexo main config (e.g. liuyib All Rights Reserved) text: # Start time. If not set, the current year will be used. since: # End time. If not set, the current year will be used. end: # The icon between the copyright and the owner. icon: enable: true # Icon name in FontAwesome, see: https://fontawesome.com/icons name: fas fa-heart # Heartbeat animation. animation: false # (Please use "" to wrap the value) color: "#ff0000" # Hexo link powered: enable: true # Whether to show version after Hexo link (e.g. vX.X.X) version: true # Theme link theme: enable: true # Whether to show version after theme link (e.g. vX.X.X) version: true # Beian information for Chinese users, see: http://www.miitbeian.gov.cn/ beian: enable: true icp: 京ICP备2020033890号 # Any custom text (e.g. Hosted by Github Pages) custom: enable: true text: 本站由 又拍云 提供加速服务 # Creative Commons 4.0 International License creative_commons: enable: true # Optional values: BY | BY-SA | BY-ND | BY-NC | BY-NC-SA | BY-NC-ND # For details, please see: https://creativecommons.org/share-your-work/licensing-types-examples/ license: BY-NC-SA # Show the CC license in the sidebar. sidebar: true # Show the CC license at the post bottom. post: true # Optional values: # id | ms | ca | da | de | en | es | es_ES | eo | eu | fr | gl | hr # it | lv | lt | hu | nl | no | pt | pt_BR | pl | ro | sl | fi | sv # tr | is | cs | el | be | ru | zh | zh_TW | uk | ar | fa | bn | ja | ko # If not set, `en` will be used by default. language: zh # Back to top back2top: enable: true icon: # Icon name in FontAwesome, see: https://fontawesome.com/icons name: fas fa-rocket # Rotation Angle of icon. rotate: -45deg # (Please use "" to wrap the value) color: "#49b1f5" # Color when the mouse hovers it (Please use "" to wrap the value) hover_color: "#fc6423" # --------------------------------------------------------------- # Sidebar config # --------------------------------------------------------------- # The sidebar of site. sidebar: enable: true # Optional values: left | right position: right # The distance from the top of the page when the sidebar is fixed (Only `px` unit is supported) offsetTop: 20px # Whether to show horizon line. horizon_line: false author: enable: true # Avatar in the site sidebar. avatar: # In theme directory (source/images): /images/avatar.png # In site directory (source/uploads): /uploads/avatar.png # You can also use a link of image. url: https://img.foolishfox.cn/images/static/avatar.jpg # If true, the avatar would be displayed in a circle. rounded: false # Opacity of avatar (value: 0 ~ 1) opacity: 1 # Mouse hover animation # Optional values: turn | shake animation: turn # Your favorite motto. motto: Learing and Coding! social_setting: enable: true # Only show by icon. icon_only: true # Table Of Contents in the Sidebar. toc: enable: true # Automatically add list number to toc. list_number: true # If true, all words will be placed on the next lines when they overflow. wrap: true # If true, the toc of post will always be displayed, rather than the activated part of it. expand_all: false # Minimum heading depth of generated toc. # You can also set it in Front-matter by `toc_max_depth`. min_depth: 1 # You can also set it in Front-matter by `toc_min_depth`. # Maximum heading depth of generated toc. max_depth: 4 # Subscribe of email and rss. feed: enable: true # Enter your email subscription link (e.g. http://eepurl.com/guAE6j) email: https://briefcake.com/s/foolishfox # Enter the rss address of you set (e.g. /atom.xml) # Dependency: https://github.com/hexojs/hexo-generator-feed/ # !!! Don't enable this before install dependency by `npm install hexo-generator-feed --save` in hexo root directory. rss: /atom.xml # The reading progress of post. reading_progress: enable: true # (Please use "" to wrap the value) color: "#fc6423" height: 1px # --------------------------------------------------------------- # Page config # --------------------------------------------------------------- codeblock: # The style of code block. # Optional values: default | simple | carbon style: default # The theme of code highlight. # Optional values: light | dark | ocean highlight: ocean # Whether to wrap when code overflow. word_wrap: false # Add a line below h1, h2 tags. heading_line: true # --------------------------------------------------------------- # Post config # --------------------------------------------------------------- # The information of post. post_meta: # Only show by icon. icon_only: false # The create time of post. created: enable: true # Icon name in FontAwesome, see: https://fontawesome.com/icons icon: far fa-calendar-plus # The update time of post. updated: enable: true # Icon name in FontAwesome, see: https://fontawesome.com/icons icon: far fa-calendar-check # The approximate reading time of post. # Dependency: https://github.com/willin/hexo-wordcount/ # !!! Don't enable this before install dependency by `npm install hexo-wordcount --save` in hexo root directory. reading_time: enable: false # Icon name in FontAwesome, see: https://fontawesome.com/icons icon: far fa-clock # Set reading speed to count reading time. speed: # Reading speed of zh-CN. zh: 200 # Reading speed of en-US. en: 80 # Counting the words of post. # Dependency: https://github.com/willin/hexo-wordcount/ # !!! Don't enable this before install dependency by `npm install hexo-wordcount --save` in hexo root directory. word_count: enable: true # Icon name in FontAwesome, see: https://fontawesome.com/icons icon: far fa-file-word # The article list on the homepage or archives page. post_list: # Whether to paginate. paginate: home: true archives: false # Whether to show the cover image of post. cover_image: home: true # The widget of post. post_widget: # Whether to show tags at the bottom of post. tags: true # Whether to show "------ END ------" at the bottom of post. end_text: enable: true # Whether to show a horizon line before "------ END ------". horizon_line: true # Article sharing share: enable: true # The text displayed before the share button. label: "Share to: " # Optional values: qzone | qq | weibo | wechat | douban | linkedin | facebook | twitter | google target: qzone, qq, weibo, wechat, douban # Stick post to the top # Dependency: https://github.com/netcan/hexo-generator-index-pin-top/ # !!! Don't enable this before install dependency by `npm install hexo-generator-index-pin-top --save` in hexo directory. stick_top: # Position of icon # Optional values: left | right position: right # Icon name in FontAwesome, see: https://fontawesome.com/icons icon: fas fa-thumbtack # Rotation Angle of icon. rotate: 45deg # (Please use "" to wrap the value) color: "#999" # --------------------------------------------------------------- # Comment config # --------------------------------------------------------------- # Waline # See: https://waline.js.org/ waline: enable: true # serverURL serverURL: https://api.foolishfox.cn/waline # Comment box placeholder. placeholder: Just go go # Gravatar style. avatar: wavatar # Custom comment header. meta: nick,mail,link # the number of comments of each page pageSize: # Optional values: en | zh-cn | zh-TW | jp lang: zh-CN,zh-TW,en # visitor statistics visitor: true # --------------------------------------------------------------- # Statistics and Analytics config # --------------------------------------------------------------- # Busuanzi statistics # See: https://busuanzi.ibruce.info/ busuanzi: enable: true # Only show by icon. icon_only: false # Number of unique visitor to the entire site. site_uv: enable: true # Icon name in FontAwesome, see: https://fontawesome.com/icons icon: fas fa-user # Number of page view to the entire site. site_pv: enable: true icon: fas fa-eye # Number of page view to a post. post_pv: enable: false icon: fas fa-eye # --------------------------------------------------------------- # Search config # --------------------------------------------------------------- # Local Search # See: https://github.com/wzpan/hexo-generator-search/ local_search: enable: true # Canvas-nest # Dependency: https://github.com/hustcc/canvas-nest.js canvas_nest: enable: true # Color of lines. # RGB values, use `,` to separate. color: "0,0,0" # The opacity of lines (value: 0 ~ 1) opacity: 0.6 # The number of lines. count: 99 # `z-index` property of the background. zIndex: -1 # --------------------------------------------------------------- # Math and Chart config # --------------------------------------------------------------- math: enable: true # If true, this function will be enabled on every page. # If false, this function will be enabled only if the page where `math: true` is set in `Front-matter`. per_page: false # ! ------------------------------------------------------------------------------- # ! Please see the documentation before using. See: # ! https://theme-stun.github.io/docs/zh-CN/advanced/third-part.html#mathjax # ! ------------------------------------------------------------------------------- # Optional values: mathjax | katex engine: katex mathjax: cdn: https://cdn.jsdelivr.net/npm/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML # See: https://mhchem.github.io/MathJax-mhchem/ mhchem: enable: false mhchem_js: https://cdn.jsdelivr.net/npm/mathjax-mhchem@3.3.2/mhchem.min.js katex: cdn: https://cdn.bootcdn.net/ajax/libs/KaTeX/0.12.0/katex.min.css # See: https://github.com/KaTeX/KaTeX/tree/master/contrib/copy-tex copy_tex: enable: true copy_tex_js: https://cdn.bootcdn.net/ajax/libs/KaTeX/0.12.0/contrib/copy-tex.min.js copy_tex_css: https://cdn.bootcdn.net/ajax/libs/KaTeX/0.12.0/contrib/copy-tex.css # --------------------------------------------------------------- # Other config # --------------------------------------------------------------- # Fancybox # See: https://fancyapps.com/fancybox/3/ fancybox: true # Click to enlarge picture. zoom_image: enable: true # The color of mask. # (Please use "" to wrap the value) mask_color: "rgba(0,0,0,0.6)" # The gap between image and a edge of screen when image is enlarged. # (Only `px` unit is supported) gap_aside: 20px # Lazy load the images of post. # See: https://github.com/tuupola/lazyload lazyload: enable: true # Optional values: gif | block placeholder: gif # Quicklink support # See: https://github.com/GoogleChromeLabs/quicklink/ quicklink: enable: false # Quicklink (quicklink.umd.js script) is loaded on demand. # Add `quicklink: true` in Front-matter of the page or post you need. # Home page and archive page can be controlled through home and archive options below. home: true archive: true # Initialize quicklink after the load event fires. delay: true # Custom a time in milliseconds by which the browser must execute prefetching. timeout: 10000 # Enable fetch() or falls back to XHR. priority: true # For more flexibility you can add some patterns (RegExp, Function, or Array) to ignores. # See: https://github.com/GoogleChromeLabs/quicklink#custom-ignore-patterns # ! -------------------------------------------------- # ! If you don't know the following, please ignore it. # ! -------------------------------------------------- ignores: - /\/api\/?/ - uri => uri.includes('.xml') - uri => uri.includes('.zip') - (uri, el) => el.hasAttribute('nofollow') - (uri, el) => el.hasAttribute('noprefetch') # Pjax # See: https://github.com/MoOx/pjax/ pjax: enable: false # When switching pages, scroll to the bottom of the top image. avoid_banner: false # ! -------------------------------------------------- # ! If you don't know the following, please ignore it. # ! -------------------------------------------------- # Please see: https://github.com/MoOx/pjax/#options elements: selectors: switches: switchesOptions: history: true # If you enable this, you must set `avoid_banner: false` firstly. scrollTo: false scrollRestoration: false cacheBust: false debug: false currentUrlFullReload: false timeout: 0 # The links with `target="_blank"` attribute. external_link: # Adding an icon make it easier for users to know that this is an external link. icon: enable: true # Icon name in FontAwesome, see: https://fontawesome.com/icons name: fas fa-external-link-alt # (Please use "" to wrap the value) color: "#aaa" # The shortcuts of the site. shortcuts: # Switch to the prev / next post by key. # `Ctrl + ←` is the shortcuts to prev post. # `Ctrl + →` is the shortcuts to next post. switch_post: enable: false ```

预期行为

文章页sidebar的目录默认折叠,滚动到对应位置时自动展开


liuyib commented 3 years ago

@YiHui-Liu 请问是所有文章的目录都不能展开吗,还是个别文章的目录不能展开?

liuyib commented 3 years ago

如果是个别文章的目录不能展开,麻烦提供下无法展开目录的文章的 Markdown 源码

YiHui-Liu commented 3 years ago

没有试过,目前只有一篇文章有多重目录,源码:

## 最低工资与资本剥削

  最低工资法是国家制定的最低工资标准的法律,规定了劳动者在正常劳动的情况下,用人单位应当给予的最低劳动报酬,这个标准一般是根据劳动者的最低生活需要来制定的。而以薛兆丰为代表的一帮自由主义经济学家发表言论称:
>最低工资法是世界上最典型的法定福利,这种硬性规定的后果,是低薪工人失业
>用命令或法律来规定工资和福利的高低,就是枉费心机

<!-- more -->

### 材料
1. [最低工资法不可取-薛兆丰](http://xuezhaofeng.com/blog/?p=33)
2. [为什么反对最低工资制度](http://xuezhaofeng.com/blog/?p=833)(见第十点)
3. [最低工资法以善意伤害穷人](http://money.163.com/special/0025404U/zuidigongzihairen.html)
4. ![截图](https://img.foolishfox.cn/images/2020/12/Propic.png)

### 市场经济三大规律
&emsp;&emsp;马克思主义认为**市场经济有三大规律**:

### 劳动力商品
&emsp;&emsp;另外**劳动力商品的价值是由维持和延续劳动力所必须的生活资料的价值决定的,是由生产和再生产自身劳动力商品所消耗的生活资料的价值决定的**。

### 政治与经济因素
&emsp;&emsp;材料中还有一句话:
>用命令或法律来规定工资和福利的高低,就是枉费心机

## 后记
&emsp;&emsp;马克思主义基本原理概论课程报告

具体情况可以见:https://foolishfox.cn/posts/202012-c.html

liuyib commented 3 years ago

好的,我会尽快定位问题并解决,请耐心等候

liuyib commented 3 years ago

@YiHui-Liu 问题原因:Hexo 5.0.0 之后,生成目录时对字符进行编码,见:https://github.com/hexojs/hexo/commit/d83557855f2467abce6fd24768bf435379062681

类似 Issues:https://github.com/liuyib/hexo-theme-stun/issues/138, https://github.com/liuyib/hexo-theme-stun/issues/102

Stun 主题进行了兼容性处理,现在目录不能自动展开的问题应该被彻底解决了,见:https://github.com/liuyib/hexo-theme-stun/commit/7b2b507b6f0ba2ed746d69f38130bcf5acf41308

YiHui-Liu commented 3 years ago

好的,问题解决了,谢谢