Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v4' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
hulinjiang committed Dec 9, 2024
2 parents 62bed15 + a6219b6 commit 766ab9b
Show file tree
Hide file tree
Showing 15 changed files with 253 additions and 308 deletions.
11 changes: 2 additions & 9 deletions quartz.layout.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {PageLayout, SharedLayout} from "./quartz/cfg"
import { PageLayout, SharedLayout } from "./quartz/cfg"
import * as Component from "./quartz/components"

// components shared across all pages
Expand Down Expand Up @@ -36,26 +36,19 @@ export const defaultContentPageLayout: PageLayout = {
Component.Breadcrumbs(),
Component.ArticleTitle(),
Component.ContentMeta(),
Component.TagList()
// Component.TagList()
],
left: [
Component.PageTitle(),
Component.MobileOnly(Component.Spacer()),
Component.Search(),
Component.DesktopOnly(Component.SidebarNav()),
// Component.DesktopOnly(Component.RecentNotes({
// showTags: false,
// linkToMore: "/Archive",
// limit: 5,
// filter: (f) => !f.filePath?.includes("/Archive")
// })),
Component.DesktopOnly(Component.Explorer({
folderClickBehavior: 'collapse',
})),
Component.DesktopOnly(Component.FloatingButtons({
position: 'right',
})),
// Component.TagList(),
],
right: [
Component.DesktopOnly(Component.Graph({
Expand Down
39 changes: 20 additions & 19 deletions quartz/components/ContentMeta.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {QuartzComponentConstructor, QuartzComponentProps} from "./types"
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
import readingTime from "reading-time"
import {classNames} from "../util/lang"
import { classNames } from "../util/lang"
import style from "./styles/contentMeta.scss"
import { pathToRoot, slugTag } from "../util/path"

const TimeMeta = ({ value }: { value: Date }) => {
const year = value.getFullYear()
Expand Down Expand Up @@ -91,23 +92,23 @@ function ContentMetadataComponent({ cfg, fileData, displayClass }: QuartzCompone
</div>
</div>

{/*{fileData.frontmatter?.tags && fileData.frontmatter.tags.length > 0 && (*/}
{/* <div class="meta-tags">*/}
{/* <div class="stat-label">Tags</div>*/}
{/* <ul class="tags">*/}
{/* {fileData.frontmatter.tags.map((tag) => {*/}
{/* const linkDest = pathToRoot(fileData.slug!) + `/tags/${slugTag(tag)}`*/}
{/* return (*/}
{/* <li>*/}
{/* <a href={linkDest} class="internal tag-link">*/}
{/* {tag}*/}
{/* </a>*/}
{/* </li>*/}
{/* )*/}
{/* })}*/}
{/* </ul>*/}
{/* </div>*/}
{/*)}*/}
{fileData.frontmatter?.tags && fileData.frontmatter.tags.length > 0 && (
<div class="meta-tags">
<div class="stat-label">Tags</div>
<ul class="tags">
{fileData.frontmatter.tags.map((tag) => {
const linkDest = pathToRoot(fileData.slug!) + `/tags/${slugTag(tag)}`
return (
<li>
<a href={linkDest} class="internal tag-link">
{tag}
</a>
</li>
)
})}
</ul>
</div>
)}
</div>
</div>
)
Expand Down
10 changes: 10 additions & 0 deletions quartz/components/Head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ export default (() => {
<meta name="generator" content="Quartz"/>
<link rel="icon" href={iconPath}/>
<link rel="canonical" href={ogUrl}/>
{cfg.baseUrl && (
<>
<link
rel="alternate"
type="application/rss+xml"
title={`${cfg.pageTitle} Feed`}
href={`https://${cfg.baseUrl}/index.xml`}
/>
</>
)}
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@callmebill/lxgw-wenkai-web@latest/style.css" spa-preserve/>
<link rel="stylesheet"
Expand Down
2 changes: 1 addition & 1 deletion quartz/components/pages/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {QuartzComponent, QuartzComponentConstructor, QuartzComponentProps} from
const Content: QuartzComponent = ({ fileData, tree }: QuartzComponentProps) => {
const content = htmlToJsx(fileData.filePath!, tree)
const classes: string[] = fileData.frontmatter?.cssclasses ?? []
const classString = ["popover-hint page-transition", ...classes].join(" ")
const classString = ["popover-hint", ...classes].join(" ")
return <article class={classString}>{content}</article>
}

Expand Down
2 changes: 1 addition & 1 deletion quartz/components/renderPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export function renderPage(
<Body {...componentData}>
{LeftComponent}
<div class="center inner">
<div class="page-header page-transition">
<div class="page-header">
<Header {...componentData}>
{header.map((HeaderComponent) => (
<HeaderComponent {...componentData} />
Expand Down
2 changes: 1 addition & 1 deletion quartz/components/scripts/svg-pan-zoom.inline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function createCopyButton(): HTMLButtonElement {
// 定义 processSvg 函数
function processSvg(svg: Element) {
if (!(svg instanceof SVGElement)) return

try {
const configStr = svg.getAttribute('data-svg-pan-zoom')
const config = configStr ? JSON.parse(configStr) : {}
Expand Down
41 changes: 37 additions & 4 deletions quartz/components/styles/contentMeta.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@
border: 1px solid var(--secondary);
border-radius: var(--border-radius);
padding: 1.5rem;
transition: all 0.15s ease-out;

.meta-tags {
margin-top: 1.5rem;
padding-top: 1.5rem;
border-top: 1px solid var(--secondary);
}
}

.meta-description {
Expand Down Expand Up @@ -100,7 +105,7 @@
padding: 1.2rem;
border-radius: var(--border-radius);
position: relative;

&::before {
content: '"';
position: absolute;
Expand Down Expand Up @@ -153,7 +158,7 @@
align-items: flex-start;
gap: 0.2rem;

> div:last-child {
>div:last-child {
color: var(--gray);
font-size: 0.9rem;
}
Expand Down Expand Up @@ -191,9 +196,37 @@

.stat-item {
min-width: unset;

.stat-value {
font-size: 0.95rem;
}
}
}

//集成了tag-list之后, 把样式也复制过来
.tags {
list-style: none;
display: flex;
padding-left: 0;
gap: 0.4rem;
margin: 1rem 0;
flex-wrap: wrap;
}

.section-li>.section>.tags {
justify-content: flex-end;
}

.tags>li {
display: inline-block;
white-space: nowrap;
margin: 0;
overflow-wrap: normal;
}

a.internal.tag-link {
border-radius: 8px;
background-color: var(--highlight);
padding: 0.2rem 0.4rem;
margin: 0 0.1rem;
}
15 changes: 10 additions & 5 deletions quartz/components/styles/footer.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
footer {
a {
text-decoration: none; /* 去除链接默认的下划线 */
border-bottom: 1px dashed ; /* 设置底部边框为 1 像素宽的虚线,颜色为黑色 */
text-decoration: none;
/* 去除链接默认的下划线 */
border-bottom: 1px dashed;
/* 设置底部边框为 1 像素宽的虚线,颜色为黑色 */
}

p {
text-align: center;
opacity: 0.7;
//position: relative;
//z-index: var(--z-content) + 1;

//404页面问题
position: relative;
z-index: var(--z-bottom);
isolation: isolate;
}
}
}
18 changes: 9 additions & 9 deletions quartz/components/styles/graph.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@use "../../styles/variables.scss" as *;

.graph {
& > h3 {
&>h3 {
font-size: 1rem;
margin: 0;
}

& > .graph-outer {
&>.graph-outer {
border-radius: 5px;
border: 1px solid var(--lightgray);
box-sizing: border-box;
Expand All @@ -15,7 +15,7 @@
position: relative;
overflow: hidden;

& > #global-graph-icon {
&>#global-graph-icon {
color: var(--dark);
opacity: 0.5;
width: 18px;
Expand All @@ -29,19 +29,19 @@
background-color: transparent;
transition: background-color 0.5s ease;
cursor: pointer;

&:hover {
background-color: var(--lightgray);
}
}

& > #graph-container {

&>#graph-container {
background: var(--light);
box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}
}

& > #global-graph-outer {
&>#global-graph-outer {
position: fixed;
// z-index: 9999;
z-index: var(--z-overlay);
Expand All @@ -57,7 +57,7 @@
display: inline-block;
}

& > #global-graph-container {
&>#global-graph-container {
border: 1px solid var(--lightgray);
background-color: var(--light);
border-radius: 5px;
Expand All @@ -67,11 +67,11 @@
left: 50%;
transform: translate(-50%, -50%);
height: 60vh;
width: 50vw;
width: 80vw;

@media all and (max-width: $fullPageWidth) {
width: 90%;
}
}
}
}
}
25 changes: 9 additions & 16 deletions quartz/components/styles/popover.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
opacity: 0;
visibility: hidden;
}

1% {
opacity: 0;
}

100% {
opacity: 1;
visibility: visible;
Expand All @@ -20,7 +22,7 @@
overflow: visible;
padding: 1rem;

& > .popover-inner {
&>.popover-inner {
position: relative;
width: 30rem;
max-height: 20rem;
Expand All @@ -38,7 +40,8 @@
white-space: normal;
}

& > .popover-inner[data-content-type] {
&>.popover-inner[data-content-type] {

&[data-content-type*="pdf"],
&[data-content-type*="image"] {
padding: 0;
Expand Down Expand Up @@ -66,9 +69,8 @@

visibility: hidden;
opacity: 0;
transition:
opacity 0.3s ease,
visibility 0.3s ease;
transition: opacity 0.3s ease,
visibility 0.3s ease;

@media all and (max-width: $mobileBreakpoint) {
display: none !important;
Expand All @@ -82,18 +84,9 @@ a:hover .popover,
animation-delay: 0.2s;
}

// 在页眉、侧边中禁用 popover
.page-header,
.recent-notes{
//popover还是会被遮挡, 索性禁用
.recent-notes {
.popover {
display: none !important;
}
}

// 在特定页面(tags页面和非index页面)的文章中启用 popover
body[data-slug^="tags/"] article,
body:not([data-slug$="/index"]) article {
.popover {
display: block !important;
}
}
4 changes: 2 additions & 2 deletions quartz/i18n/locales/zh-CN.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Translation} from "./definition"
import { Translation } from "./definition"

export default {
propertyDefaults: {
Expand All @@ -22,7 +22,7 @@ export default {
quote: "引用",
},
backlinks: {
title: "📎 反向链接",
title: "📎 提到当前文章的链接",
noBacklinksFound: "未发现反向链接",
},
themeToggle: {
Expand Down
Loading

0 comments on commit 766ab9b

Please sign in to comment.