mobile fixes, fix bug when linking to anchor on home, docs

This commit is contained in:
Jacky Zhao
2023-08-06 17:09:29 -07:00
parent d38837c15d
commit a58458a99e
14 changed files with 134 additions and 24 deletions

View File

@ -45,3 +45,4 @@ export interface FullPageLayout {
}
export type PageLayout = Pick<FullPageLayout, "beforeBody" | "left" | "right">
export type SharedLayout = Pick<FullPageLayout, "head" | "header" | "footer">

View File

@ -228,7 +228,7 @@ function _isRelativeSegment(s: string): boolean {
return /^\.{0,2}$/.test(s)
}
function _stripSlashes(s: string): string {
export function _stripSlashes(s: string): string {
if (s.startsWith("/")) {
s = s.substring(1)
}

View File

@ -2,6 +2,7 @@ import { QuartzTransformerPlugin } from "../types"
import {
CanonicalSlug,
RelativeURL,
_stripSlashes,
canonicalizeServer,
joinSegments,
pathToRoot,
@ -35,7 +36,7 @@ export const CrawlLinks: QuartzTransformerPlugin<Partial<Options> | undefined> =
return (tree, file) => {
const curSlug = canonicalizeServer(file.data.slug!)
const transformLink = (target: string): RelativeURL => {
const targetSlug = transformInternalLink(target).slice("./".length)
const targetSlug = _stripSlashes(transformInternalLink(target).slice(".".length))
let [targetCanonical, targetAnchor] = splitAnchor(targetSlug)
if (opts.markdownLinkResolution === "relative") {
return targetSlug as RelativeURL

View File

@ -225,7 +225,6 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
}
// internal link
// const url = transformInternalLink(fp + anchor)
const url = fp + anchor
return {
type: "link",

View File

@ -81,7 +81,9 @@ a {
.page {
@media all and (max-width: $fullPageWidth) {
margin: 0 5vw;
margin: 0 auto;
padding: 0 1rem;
max-width: 800px;
}
& article {