mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-06 00:45:05 +00:00
finish path refactoring, add sourcemap + better trace support
This commit is contained in:
parent
906f91f8ee
commit
3ac6b42e16
36 changed files with 331 additions and 1170 deletions
quartz/components/pages
|
@ -5,11 +5,11 @@ import path from "path"
|
|||
|
||||
import style from '../styles/listPage.scss'
|
||||
import { PageList } from "../PageList"
|
||||
import { toServerSlug } from "../../path"
|
||||
import { canonicalizeServer } from "../../path"
|
||||
|
||||
function FolderContent(props: QuartzComponentProps) {
|
||||
const { tree, fileData, allFiles } = props
|
||||
const folderSlug = toServerSlug(fileData.slug!)
|
||||
const folderSlug = canonicalizeServer(fileData.slug!)
|
||||
const allPagesInFolder = allFiles.filter(file => {
|
||||
const fileSlug = file.slug ?? ""
|
||||
const prefixed = fileSlug.startsWith(folderSlug)
|
||||
|
@ -23,7 +23,7 @@ function FolderContent(props: QuartzComponentProps) {
|
|||
...props,
|
||||
allFiles: allPagesInFolder
|
||||
}
|
||||
|
||||
|
||||
// @ts-ignore
|
||||
const content = toJsxRuntime(tree, { Fragment, jsx, jsxs, elementAttributeNameCase: 'html' })
|
||||
return <div class="popover-hint">
|
||||
|
|
|
@ -3,14 +3,14 @@ import { Fragment, jsx, jsxs } from 'preact/jsx-runtime'
|
|||
import { toJsxRuntime } from "hast-util-to-jsx-runtime"
|
||||
import style from '../styles/listPage.scss'
|
||||
import { PageList } from "../PageList"
|
||||
import { toServerSlug } from "../../path"
|
||||
import { ServerSlug, canonicalizeServer } from "../../path"
|
||||
|
||||
function TagContent(props: QuartzComponentProps) {
|
||||
const { tree, fileData, allFiles } = props
|
||||
const slug = fileData.slug
|
||||
|
||||
if (slug?.startsWith("tags/")) {
|
||||
const tag = toServerSlug(slug.slice("tags/".length))
|
||||
const tag = canonicalizeServer(slug.slice("tags/".length) as ServerSlug)
|
||||
const allPagesWithTag = allFiles.filter(file => (file.frontmatter?.tags ?? []).includes(tag))
|
||||
const listProps = {
|
||||
...props,
|
||||
|
@ -27,7 +27,7 @@ function TagContent(props: QuartzComponentProps) {
|
|||
</div>
|
||||
</div>
|
||||
} else {
|
||||
throw `Component "TagContent" tried to render a non-tag page: ${slug}`
|
||||
throw new Error(`Component "TagContent" tried to render a non-tag page: ${slug}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue