个人的 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 @Bean 相同加载顺序不同结果不同的问题记录

《关于Spring@Bean相同加载顺序不同结果不同的问题记录》本文主要探讨了在Spring5.1.3.RELEASE版本下,当有两个全注解类定义相同类型的Bean时,由于加载顺序不同,最终生成的... 目录问题说明测试输出1测试输出2@Bean注解的BeanDefiChina编程nition加入时机总结问题说明

SpringBoot+MyBatis-Flex配置ProxySQL的实现步骤

《SpringBoot+MyBatis-Flex配置ProxySQL的实现步骤》本文主要介绍了SpringBoot+MyBatis-Flex配置ProxySQL的实现步骤,文中通过示例代码介绍的非常详... 目录 目标 步骤 1:确保 ProxySQL 和 mysql 主从同步已正确配置ProxySQL 的

Spring Boot整合log4j2日志配置的详细教程

《SpringBoot整合log4j2日志配置的详细教程》:本文主要介绍SpringBoot项目中整合Log4j2日志框架的步骤和配置,包括常用日志框架的比较、配置参数介绍、Log4j2配置详解... 目录前言一、常用日志框架二、配置参数介绍1. 日志级别2. 输出形式3. 日志格式3.1 PatternL

配置springboot项目动静分离打包分离lib方式

《配置springboot项目动静分离打包分离lib方式》本文介绍了如何将SpringBoot工程中的静态资源和配置文件分离出来,以减少jar包大小,方便修改配置文件,通过在jar包同级目录创建co... 目录前言1、分离配置文件原理2、pom文件配置3、使用package命令打包4、总结前言默认情况下,

VScode连接远程Linux服务器环境配置图文教程

《VScode连接远程Linux服务器环境配置图文教程》:本文主要介绍如何安装和配置VSCode,包括安装步骤、环境配置(如汉化包、远程SSH连接)、语言包安装(如C/C++插件)等,文中给出了详... 目录一、安装vscode二、环境配置1.中文汉化包2.安装remote-ssh,用于远程连接2.1安装2

将sqlserver数据迁移到mysql的详细步骤记录

《将sqlserver数据迁移到mysql的详细步骤记录》:本文主要介绍将SQLServer数据迁移到MySQL的步骤,包括导出数据、转换数据格式和导入数据,通过示例和工具说明,帮助大家顺利完成... 目录前言一、导出SQL Server 数据二、转换数据格式为mysql兼容格式三、导入数据到MySQL数据

关于rpc长连接与短连接的思考记录

《关于rpc长连接与短连接的思考记录》文章总结了RPC项目中长连接和短连接的处理方式,包括RPC和HTTP的长连接与短连接的区别、TCP的保活机制、客户端与服务器的连接模式及其利弊分析,文章强调了在实... 目录rpc项目中的长连接与短连接的思考什么是rpc项目中的长连接和短连接与tcp和http的长连接短

Redis多种内存淘汰策略及配置技巧分享

《Redis多种内存淘汰策略及配置技巧分享》本文介绍了Redis内存满时的淘汰机制,包括内存淘汰机制的概念,Redis提供的8种淘汰策略(如noeviction、volatile-lru等)及其适用场... 目录前言一、什么是 Redis 的内存淘汰机制?二、Redis 内存淘汰策略1. pythonnoe

Oracle查询优化之高效实现仅查询前10条记录的方法与实践

《Oracle查询优化之高效实现仅查询前10条记录的方法与实践》:本文主要介绍Oracle查询优化之高效实现仅查询前10条记录的相关资料,包括使用ROWNUM、ROW_NUMBER()函数、FET... 目录1. 使用 ROWNUM 查询2. 使用 ROW_NUMBER() 函数3. 使用 FETCH FI

windos server2022的配置故障转移服务的图文教程

《windosserver2022的配置故障转移服务的图文教程》本文主要介绍了windosserver2022的配置故障转移服务的图文教程,以确保服务和应用程序的连续性和可用性,文中通过图文介绍的非... 目录准备环境:步骤故障转移群集是 Windows Server 2022 中提供的一种功能,用于在多个