Skip to content

Commit

Permalink
Merge pull request PKM-er#814 from PandaNocturne/24.07.06_Panda
Browse files Browse the repository at this point in the history
提交2个CSS片段
  • Loading branch information
juestchaos committed Jul 8, 2024
2 parents 997fa46 + ff13760 commit 4e7acec
Show file tree
Hide file tree
Showing 4 changed files with 239 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
uid: 20240706122546
title: Obsidian 样式 -Minimal 主题的 Outline Callout
tags:
- CSS片段
- Minimal
- callout
description: 该片段摘自 Minimal 主题,Callout 的 Outline 形式是一种更为简洁的 Callout。
author: 熊猫别熬夜
type: other
draft: false
editable: false
modified: 20240706122605
---

# Obsidian 样式 -Minimal 主题的 Outline Callout

![24.07.06_Obsidian样式-Minimal主题的Outline Callout](https://cdn.pkmer.cn/images/202407061225057.png!pkmer)

该片段摘自 Minimal 主题,Callout 的 Outline 形式是一种更为简洁的 Callout。

```css

/* 该片段摘自Minimal主题 by 熊猫别熬夜 2024-07-06_12-08 */
/* .markdown-source-view.mod-cm6 .cm-embed-block{
width: fit-content;
} */

.is-live-preview.is-readable-line-width>.cm-callout .callout {
max-width: var(--max-width);
margin: 0 auto;
}

.callout .callout-title {
background-color: var(--background-primary);
margin-top: -24px;
z-index: 200;
width: fit-content;
padding: 0 0.5em;
margin-left: -0.75em;
letter-spacing: 0.05em;
font-variant-caps: all-small-caps;
}

.callout {
overflow: visible;
--callout-border-width: 1px;
--callout-border-opacity: 0.5;
--callout-title-size: 0.8em;
--callout-blend-mode: normal;
background-color: transparent;
/* width: fit-content; */
}

.cm-embed-block.cm-callout {
padding-top: 12px;
}

.callout-content .callout {
margin-top: 18px;
}

```
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ author: 熊猫别熬夜
type: other
draft: false
editable: false
modified: 20240122233625
modified: 20240706122904
---

# Obsidian 样式 - minimal 主题 Cards 卡片布局
Expand All @@ -32,7 +32,7 @@ modified: 20240122233625

在 yaml 区用 cssclass 申明 `list-cards` 将笔记中的所有无序列表转换为卡片

![Obsidian 样式 - minimal 主题 Cards 卡片布局]](https://cdn.pkmer.cn/images/202309162149987.png!pkmer)
![Obsidian 样式 - minimal 主题 Cards 卡片布局]](<https://cdn.pkmer.cn/images/202309162149987.png!pkmer>)

### 卡片的布局设定

Expand Down Expand Up @@ -489,4 +489,4 @@ body {

## ChangeLog

- 2024-06-19:修复1.6以上版本的错乱问题
- 2024-06-19:修复 1.6 以上版本的错乱问题
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
---
uid: 20240706122404
title: Obsidian 样式 - 分栏分列布局 (Column-Page)
tags: [分栏, 主页, 笔记样式]
description: 这是一个用于 Obsidian 中的分列布局样式,将笔记内容分栏显示,适用于包含大量内容或是需要目录索引的页面。
author: 熊猫别熬夜
type: other
draft: false
editable: false
modified: 20240706122900
---

# Obsidian 样式 - 分栏分列布局 (Column-Page)

这是一个用于 Obsidian 中的分列布局样式,将笔记内容分栏显示,适用于包含大量内容或是需要目录索引的页面。

## 视图类型

### 横向分布

![24.06.29_Obsidian样式-分栏分列布局 (Column-Page)](https://cdn.pkmer.cn/images/202407061224272.png!pkmer)

高度不变,宽度随内容变化,元素不能跨列分区

![24.06.29_Obsidian样式-分栏分列布局 (Column-Page)](https://cdn.pkmer.cn/images/202407061224933.gif!pkmer)

### 纵向分布

![24.06.29_Obsidian样式-分栏分列布局 (Column-Page)](https://cdn.pkmer.cn/images/202407061224418.png!pkmer)

纵向模式,宽度不变,元素可以跨列分区

![24.06.29_Obsidian样式-分栏分列布局 (Column-Page)](https://cdn.pkmer.cn/images/202407061224432.gif!pkmer)

## 使用方法

在当前笔记的属性 (Properties) 面板的 `cssclasses` 属性中添加 `column-page` 属性值:

![24.06.29_Obsidian样式-分栏分列布局 (Column-Page)](https://cdn.pkmer.cn/images/202407061224150.png!pkmer)

### 调整视图类型

- 从 Style Setting 设置中调整默认视图类型:
- 默认 `column-page` 视图为 `横向视图`,可以切换:
![24.06.29_Obsidian样式-分栏分列布局 (Column-Page)](https://cdn.pkmer.cn/images/202407061224505.png!pkmer)
- 直接修改视图属性:
- 设置 `column-page-v` 属性,即直接设置**纵向视图**
- 将 `column-page`→`column-page-v`
- 设置 `column-page-h` 属性,即直接设置**横向视图**
- 将 `column-page`→`column-page-h`

### 常驻分列视图 (不推荐)

可以设置默认所有界面在阅读模式下为分列布局的样式,需要在 Style Setting 插件设置面板中设置:

![24.06.29_Obsidian样式-分栏分列布局 (Column-Page)](https://cdn.pkmer.cn/images/202407061224930.png!pkmer)

## CSS 样式

```css
/* @settings
name: 【分栏】分栏布局(Column-Page)
id: ColumnPage
settings:
- id: column-page
title: 分列布局(Column-Page)
type: class-toggle
addCommand: true
- id: column-page-width
title: 分栏宽度
description: 分栏最小宽度,单位为px
type: variable-number
default: 550
format: px
- id: column-page-type
title: 默认分布模式
type: class-select
allowEmpty: false
options:
- value: column-h
label: 横向模式,高度不变,不能跨列
- value: column-v
label: 纵向模式,宽度不变,可以跨列
default: column-h
*/
/*! 分栏布局页面 by 熊猫 */
body {
--column-page-width: 550px;
}

.column-v .column-page,
.column-page-v{
& .markdown-preview-section {
--file-line-width: 100% !important;

& .snw-header-count-wrapper {
right: unset;
}

column-gap: 2rem;
column-width: var(--column-page-width) !important;
column-rule: 2px dashed var(--background-modifier-border);
column-fill: balance;
/* 缩减底部空白 不然可能加载成空白页 */
padding-bottom: 0px !important;
min-height: unset !important;

/* 字体大小和行内高度改变,你可以不改变,并删掉 */
font-size: 18px !important;
line-height: 160%;

/* 标题更紧凑一点 */
& h2, h3, h4, h5, h6 {
margin-top: 10px;
margin-bottom: 5px;
}

& p {
break-inside: avoid;
}

/* 选择不分列的元素,默认为h1,hr */
& h1, hr {
column-span: all;
}

/* 多列布局后,部分列表圆点会错位,这样可以避免 */
& .list-bullet {
position: absolute;
}
}

&.column-h2 h2 {
column-span: all;
}
}
.column-h .column-page,
.column-page-h{
& .markdown-preview-section {
--file-line-width: 100% !important;

& .snw-header-count-wrapper {
right: unset;
}

column-gap: 2rem;
column-width: var(--column-page-width) !important;
column-rule: 2px dashed var(--background-modifier-border);
column-fill: auto;
height: 100%;
/* 缩减底部空白 不然可能加载成空白页 */
padding-bottom: 0px !important;
min-height: unset !important;

/* 字体大小和行内高度改变,你可以不改变,并删掉 */
font-size: 18px !important;
line-height: 160%;

/* 标题更紧凑一点 */
& h2, h3, h4, h5, h6 {
margin-top: 10px;
margin-bottom: 5px;
}

/* 多列布局后,部分列表圆点会错位,这样可以避免 */
& .list-bullet {
position: absolute;
}
}
}
```
2 changes: 2 additions & 0 deletions 10-Obsidian/Obsidian外观/Obsidian的CSS代码片段.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Obsidian 还支持一种外部样式代码引用的方式。
- [[Obsidian样式-隐藏 markdown 标记]]
- [[Obsidian 样式-表格优化]]
- [[Obsidian样式-笔记内容居左或居中切换]]
- [[Obsidian样式-分栏分列布局 (Column-Page)]]

### 代码块

Expand Down Expand Up @@ -115,6 +116,7 @@ Obsidian 还支持一种外部样式代码引用的方式。
- [[Obsidian样式-Vicious主题的callout]]
- [[Obsidian样式-tabbed Callout]]
- [[Obsidian样式-使用 Callout 进行正文旁注]]
- [[Obsidian样式-Minimal主题的Outline Callout]]

### Properties(老称呼 Front-matter,metadata)

Expand Down

0 comments on commit 4e7acec

Please sign in to comment.