mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-03 07:18:14 +00:00
various path fixes for links to extensions, fix relative paths in links
This commit is contained in:
parent
2dc0ae279c
commit
0c199975f2
16 changed files with 77 additions and 52 deletions
quartz/plugins
|
@ -18,7 +18,7 @@ export const Assets: QuartzEmitterPlugin = () => {
|
|||
for (const fp of fps) {
|
||||
const ext = path.extname(fp)
|
||||
const src = joinSegments(argv.directory, fp) as FilePath
|
||||
const name = (slugifyFilePath(fp as FilePath) + ext) as FilePath
|
||||
const name = (slugifyFilePath(fp as FilePath, true) + ext) as FilePath
|
||||
|
||||
const dest = joinSegments(assetsPath, name) as FilePath
|
||||
const dir = path.dirname(dest) as FilePath
|
||||
|
|
|
@ -36,6 +36,7 @@ export const CreatedModifiedDate: QuartzTransformerPlugin<Partial<Options> | und
|
|||
} else if (source === "frontmatter" && file.data.frontmatter) {
|
||||
created ||= file.data.frontmatter.date
|
||||
modified ||= file.data.frontmatter.lastmod
|
||||
modified ||= file.data.frontmatter.updated
|
||||
modified ||= file.data.frontmatter["last-modified"]
|
||||
published ||= file.data.frontmatter.publishDate
|
||||
} else if (source === "git") {
|
||||
|
|
|
@ -79,9 +79,8 @@ export const CrawlLinks: QuartzTransformerPlugin<Partial<Options> | undefined> =
|
|||
) {
|
||||
if (!isAbsoluteUrl(node.properties.src)) {
|
||||
let dest = node.properties.src as RelativeURL
|
||||
const ext = path.extname(node.properties.src)
|
||||
dest = node.properties.src = transformLink(curSlug, dest, transformOptions)
|
||||
node.properties.src = dest + ext
|
||||
node.properties.src = dest
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -196,7 +196,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
|
|||
// embed cases
|
||||
if (value.startsWith("!")) {
|
||||
const ext: string = path.extname(fp).toLowerCase()
|
||||
const url = slugifyFilePath(fp as FilePath) + ext
|
||||
const url = slugifyFilePath(fp as FilePath)
|
||||
if ([".png", ".jpg", ".jpeg", ".gif", ".bmp", ".svg"].includes(ext)) {
|
||||
const dims = alias ?? ""
|
||||
let [width, height] = dims.split("x", 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue