hexo-theme-next icon indicating copy to clipboard operation
hexo-theme-next copied to clipboard

是否可以加入 codeblock 的 fold 功能

Open CCCarrion opened this issue 4 years ago • 5 comments

加入codeblock 的折叠功能。 具体来说可以参考 theme butterfly 的 highlight_shrink 功能。 附上 该主题的 git地址 https://github.com/jerryc127/hexo-theme-butterfly/ 感谢开发者

CCCarrion avatar Jan 12 '21 22:01 CCCarrion

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

welcome[bot] avatar Jan 12 '21 22:01 welcome[bot]

已经有这个功能了

{% note info no-icon This is a summary %}
{% code %}
code block in note tag
code block in note tag
code block in note tag
{% endcode %}
{% endnote %}

stevenjoezhang avatar Jan 13 '21 00:01 stevenjoezhang

已经有这个功能了

{% note info no-icon This is a summary %}
{% code %}
code block in note tag
code block in note tag
code block in note tag
{% endcode %}
{% endnote %}

代码折叠,有些代码特别长,挂上去以后影响阅读,想要的应该是代码的部分折叠,这个已有的功能是全部折叠

fightinggg avatar Sep 14 '21 02:09 fightinggg

image 就是类似这种的代码折叠,我在另一个主题中看到了,可以连同代码框一起折叠 image 大佬看能不能改进下

liuccch avatar Feb 07 '22 09:02 liuccch

我的个人观点: 现有的 {% note info no-icon This is a summary %} 方式已经能够满足要求。 折叠是为了解决代码长度过长的问题,那样只显示头几行是没有用的,所以全部折叠也可以。至于短的,不需要折叠的代码块,直接就完全展示不就行了

ljcbaby avatar Feb 07 '22 14:02 ljcbaby

可以给个是否进行折叠的开关,根据代码长度和配置项,自动确定是否折叠展示还是展示全部。当然折叠按钮可以在所有的代码块展示。

zhaomoran avatar Mar 13 '23 13:03 zhaomoran

添加了,欢迎测试: https://github.com/next-theme/hexo-theme-next/pull/679

stevenjoezhang avatar Jul 25 '23 14:07 stevenjoezhang