Skip to content

Commit

Permalink
feat: #1 #2 代码块优化,全局字体优化
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Feb 24, 2023
1 parent f19a3c7 commit b4ebff3
Show file tree
Hide file tree
Showing 6 changed files with 2,261 additions and 38 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
- 天生支持插件系统
- 同时搞定主题与预览,安装了 zhi 主题相当于额外安装了一个插件系统,一个带权限的在线博客,默认私有

**注意事项:插件系统为社区热心开发者提供,请详细了解相关机制之后再使用。强烈建议在使用之前做好数据备份,数据无价,谨慎操作!**

## TODO

- 文章预览默认带密码,custom-publish-access 字段控制,公开是public,带密码是 protected ,默认 private
- [ ] 文章预览默认带密码,custom-publish-access 字段控制,公开是 public,带密码是 protected ,默认 private

## 快速上手

Expand Down
110 changes: 110 additions & 0 deletions src/theme/widgets/code-block.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
* Copyright (c) 2023, Terwer . All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Terwer designates this
* particular file as subject to the "Classpath" exception as provided
* by Terwer in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
* or visit www.terwer.space if you need additional information or have any
* questions.
*/

/* -------------------------------------------------代码块样式--------------------------------------------------- */
.code-block {
border-radius: 1px !important;
--terwer-code-tab-bg: #f3f5f7;
border: 0.1em solid var(--b3-border-color) !important;
padding-top: 32px !important;
}

/* 代码块编辑区域/正文内容 */
.b3-typography div.hljs,
.protyle-wysiwyg div.hljs {
padding: 4px;
font-family: var(--b3-font-family-code);
}

/* 设置顶部三个mac按钮样式 */
.code-block::after {
content: " ";
position: absolute;
background: #fa625c;
box-shadow: 23px 0 #fdbc40, 45px 0 #35cd4b;
border-radius: var(--b3-border-radius-round);
top: 10px;
left: 8px;
height: 12px;
width: 12px;
z-index: 1;
}

/* ————————————————————————————————————代码块行数——————————————————————————————————*/
.protyle-linenumber__rows {
margin-top: 32px !important;
padding: 4px;
background-color: var(--b3-theme-background) !important;
margin-bottom: 0px;
font-family: var(--b3-font-family-code);
border-top-left-radius: 4px;
}

/* 代码块行数的文字颜色 */
.protyle-linenumber__rows span::before {
color: rgba(128, 128, 128, 0.5);
}

/* 代码块的语言代码 */
.b3-typography .code-block .protyle-action .protyle-action__language,
.protyle-wysiwyg .code-block .protyle-action .protyle-action__language {
margin-top: 0;
position: absolute;
right: 3.5em;
border-radius: 1px;
opacity: 1 !important;
font-family: var(--b3-font-family-code);
}

.b3-typography .code-block .protyle-action .protyle-action__language::after,
.protyle-wysiwyg .code-block .protyle-action .protyle-action__language::after {
content: "›";
font-family: var(--b3-font-family-code);
color: #80808080;
opacity: 1;
}

/* ————————————————————————————————集市里边代码块的主题—————————————————————————————— */
code.hljs {
border: 1px solid var(--b3-border-color1);
}

/* 复制和设置按钮样式 */
.b3-typography .code-block .protyle-action .protyle-icon,
.b3-typography .code-block .protyle-action .protyle-action__language,
.protyle-wysiwyg .code-block .protyle-action .protyle-icon,
.protyle-wysiwyg .code-block .protyle-action .protyle-action__language {
opacity: 1 !important;
background-color: transparent !important;
}

.b3-typography .code-block .protyle-action .protyle-icon svg,
.b3-typography .code-block .protyle-action .protyle-action__language svg,
.protyle-wysiwyg .code-block .protyle-action .protyle-icon svg,
.protyle-wysiwyg .code-block .protyle-action .protyle-action__language svg {
color: gray;
}

/* -------------------------------------------------代码块样式 END--------------------------------------------------- */
Loading

0 comments on commit b4ebff3

Please sign in to comment.