个人的 minimal-mistakes 配置记录

2024-09-03 00:36

本文主要是介绍个人的 minimal-mistakes 配置记录,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

记录一下个人的 minimal-mistakes 配置

Modifty

Change font size

assets\css\main.scss

html {font-size: 12px; // change to whatever@include breakpoint($medium) {font-size: 14px; // change to whatever}@include breakpoint($large) {font-size: 16px; // change to whatever}@include breakpoint($x-large) {font-size: 18px; // change to whatever}
}

Delete right padding of post

assets\css\main.scss

.page {@include breakpoint($large) {padding-right: 0;}@include breakpoint($x-large) {padding-right: 0;}
}

Add line number to code chunk

_config.yml

# Markdown Processing
kramdown:
...syntax_highlighter_opts:block:line_numbers: true

Add copy button to code chunk

Refer to https://github.com/iBug/iBug-source/commit/eb0180ae9eaa2d3d90c25b9c49cfb0e82fcc5e84

_includes/head.html

<script src="/assets/js/clipboard.js" async defer></script>

_sass\minimal-mistakes\_page.scss

  pre {.copy-button {position: absolute;top: 0.5em;right: 0.5em;z-index: 1;background: none;border: none;border-radius: 0.1em;padding: 0.2em 0.5em;color: white;opacity: 0.1;transition: color 0.25s linear, opacity 0.25s linear;&:hover {opacity: 1;}&:before {content: '';position: absolute;top: 0;right: 0;bottom: 0;left: 0;z-index: 2;}}&:hover .copy-button {opacity: 0.6;&:hover {opacity: 1;}}}

assets/js/clipboard.js

$(document).ready(function() {const copyText = function(text) {const isRTL = document.documentElement.getAttribute('dir') == 'rtl';var textarea = document.createElement('textarea');// Prevent zooming on iOStextarea.style.fontSize = '12pt';// Reset box modeltextarea.style.border = '0';textarea.style.padding = '0';textarea.style.margin = '0';// Move element out of screen horizontallytextarea.style.position = 'absolute';textarea.style[isRTL ? 'right' : 'left'] = '-9999px';// Move element to the same position verticallylet yPosition = window.pageYOffset || document.documentElement.scrollTop;textarea.style.top = yPosition + "px";textarea.setAttribute('readonly', '');textarea.value = text;document.body.appendChild(textarea);let success = true;try {textarea.select();success = document.execCommand("copy");} catch {success = false;}textarea.parentNode.removeChild(textarea);return success;};const copyButtonEventListener = function(event) {const thisButton = event.target;// Locate the <code> elementlet codeBlock = thisButton.nextElementSibling;while (codeBlock && codeBlock.tagName.toLowerCase() !== 'code') {codeBlock = codeBlock.nextElementSibling;}if (!codeBlock) {// No <code> found - wtf?throw new Error("No code block found beside this button. This is unexpected.");}return copyText(codeBlock.innerText);};$(".page__content pre > code").each(function() {// Locate the <pre> elementconst container = $(this).parent();var copyButton = document.createElement("button");copyButton.title = "Copy to clipboard";copyButton.className = "copy-button";copyButton.innerHTML = '<i class="far fa-copy"></i>';copyButton.addEventListener("click", copyButtonEventListener);container.prepend(copyButton);});
});

Disable scroll bar in code block

_sass\minimal-mistakes\_page.scss

  ::-webkit-scrollbar {display: none;}

最终这个也不想用了……在本地构建就可以看到复制按钮,但是 github pages 上不知道为什么看不到

不想研究了

这篇关于个人的 minimal-mistakes 配置记录的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1131516

相关文章

Spring Boot Maven 插件如何构建可执行 JAR 的核心配置

《SpringBootMaven插件如何构建可执行JAR的核心配置》SpringBoot核心Maven插件,用于生成可执行JAR/WAR,内置服务器简化部署,支持热部署、多环境配置及依赖管理... 目录前言一、插件的核心功能与目标1.1 插件的定位1.2 插件的 Goals(目标)1.3 插件定位1.4 核

RabbitMQ消息总线方式刷新配置服务全过程

《RabbitMQ消息总线方式刷新配置服务全过程》SpringCloudBus通过消息总线与MQ实现微服务配置统一刷新,结合GitWebhooks自动触发更新,避免手动重启,提升效率与可靠性,适用于配... 目录前言介绍环境准备代码示例测试验证总结前言介绍在微服务架构中,为了更方便的向微服务实例广播消息,

Zabbix在MySQL性能监控方面的运用及最佳实践记录

《Zabbix在MySQL性能监控方面的运用及最佳实践记录》Zabbix通过自定义脚本和内置模板监控MySQL核心指标(连接、查询、资源、复制),支持自动发现多实例及告警通知,结合可视化仪表盘,可有效... 目录一、核心监控指标及配置1. 关键监控指标示例2. 配置方法二、自动发现与多实例管理1. 实践步骤

nginx 负载均衡配置及如何解决重复登录问题

《nginx负载均衡配置及如何解决重复登录问题》文章详解Nginx源码安装与Docker部署,介绍四层/七层代理区别及负载均衡策略,通过ip_hash解决重复登录问题,对nginx负载均衡配置及如何... 目录一:源码安装:1.配置编译参数2.编译3.编译安装 二,四层代理和七层代理区别1.二者混合使用举例

Java JDK1.8 安装和环境配置教程详解

《JavaJDK1.8安装和环境配置教程详解》文章简要介绍了JDK1.8的安装流程,包括官网下载对应系统版本、安装时选择非系统盘路径、配置JAVA_HOME、CLASSPATH和Path环境变量,... 目录1.下载JDK2.安装JDK3.配置环境变量4.检验JDK官网下载地址:Java Downloads

Linux下进程的CPU配置与线程绑定过程

《Linux下进程的CPU配置与线程绑定过程》本文介绍Linux系统中基于进程和线程的CPU配置方法,通过taskset命令和pthread库调整亲和力,将进程/线程绑定到特定CPU核心以优化资源分配... 目录1 基于进程的CPU配置1.1 对CPU亲和力的配置1.2 绑定进程到指定CPU核上运行2 基于

Spring Boot spring-boot-maven-plugin 参数配置详解(最新推荐)

《SpringBootspring-boot-maven-plugin参数配置详解(最新推荐)》文章介绍了SpringBootMaven插件的5个核心目标(repackage、run、start... 目录一 spring-boot-maven-plugin 插件的5个Goals二 应用场景1 重新打包应用

Java中读取YAML文件配置信息常见问题及解决方法

《Java中读取YAML文件配置信息常见问题及解决方法》:本文主要介绍Java中读取YAML文件配置信息常见问题及解决方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要... 目录1 使用Spring Boot的@ConfigurationProperties2. 使用@Valu

Jenkins分布式集群配置方式

《Jenkins分布式集群配置方式》:本文主要介绍Jenkins分布式集群配置方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1.安装jenkins2.配置集群总结Jenkins是一个开源项目,它提供了一个容易使用的持续集成系统,并且提供了大量的plugin满

SpringBoot线程池配置使用示例详解

《SpringBoot线程池配置使用示例详解》SpringBoot集成@Async注解,支持线程池参数配置(核心数、队列容量、拒绝策略等)及生命周期管理,结合监控与任务装饰器,提升异步处理效率与系统... 目录一、核心特性二、添加依赖三、参数详解四、配置线程池五、应用实践代码说明拒绝策略(Rejected