mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 21:34:06 -06:00
Applied Prettier
This commit is contained in:
parent
aa51e3833e
commit
4d2dc5e4ac
@ -58,6 +58,7 @@ This part of the configuration concerns anything that can affect the whole site.
|
||||
- `highlight`: internal link background, highlighted text, [[syntax highlighting|highlighted lines of code]]
|
||||
- `textHighlight`: markdown highlighted text background
|
||||
- `optimizeImages`: whether to optimize images for web serving when building Quartz. If this is set to `true`:
|
||||
|
||||
- JPEG and PNG images will be stripped all metadata and converted to WebP format, and associated image links in [[wikilinks]] will be updated with the new file extension.
|
||||
- A resized preview image will replace every local image that have custom dimensions defined either in their [wikilink](https://help.obsidian.md/syntax#External+images) or <img> tag. The original image (optimized or not) will still be assessable as a link on the preview image.
|
||||
|
||||
|
||||
@ -6,11 +6,9 @@ import { imageExtsToOptimize, previewImageMap, targetOptimizedImageExt } from ".
|
||||
import { FullSlug, getFileExtension, isAbsoluteURL, RelativeURL } from "../../util/path"
|
||||
import { parseSelector } from "hast-util-parse-selector"
|
||||
|
||||
export interface Options {
|
||||
}
|
||||
export interface Options {}
|
||||
|
||||
const defaultOptions: Options = {
|
||||
}
|
||||
const defaultOptions: Options = {}
|
||||
|
||||
/**
|
||||
* File extensions of all supported image format. Files with an extension
|
||||
@ -36,6 +34,7 @@ export const supportedImageExts: ReadonlySet<string> = new Set([
|
||||
* Add this plugin after all Markdown parser plugins in quartz.config.
|
||||
*/
|
||||
export const Images: QuartzTransformerPlugin<Partial<Options>> = (userOpts) => {
|
||||
//@ts-ignore
|
||||
const opts = { ...defaultOptions, ...userOpts }
|
||||
|
||||
return {
|
||||
@ -139,4 +138,4 @@ const OptimizeImages: Plugin<[], HtmlRoot> = () => {
|
||||
}
|
||||
|
||||
return transformer
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>>
|
||||
// embed cases
|
||||
if (value.startsWith("!")) {
|
||||
const ext: string = path.extname(fp).toLowerCase()
|
||||
let url = slugifyFilePath(fp as FilePath)
|
||||
const url = slugifyFilePath(fp as FilePath)
|
||||
|
||||
// Handle images
|
||||
if (supportedImageExts.has(ext)) {
|
||||
@ -250,13 +250,13 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>>
|
||||
},
|
||||
},
|
||||
}
|
||||
// Handle videos
|
||||
// Handle videos
|
||||
} else if ([".mp4", ".webm", ".ogv", ".mov", ".mkv"].includes(ext)) {
|
||||
return {
|
||||
type: "html",
|
||||
value: `<video src="${url}" controls></video>`,
|
||||
}
|
||||
// Handle audio
|
||||
// Handle audio
|
||||
} else if (
|
||||
[".mp3", ".webm", ".wav", ".m4a", ".ogg", ".3gp", ".flac"].includes(ext)
|
||||
) {
|
||||
@ -264,7 +264,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>>
|
||||
type: "html",
|
||||
value: `<audio src="${url}" controls></audio>`,
|
||||
}
|
||||
// Handle documents
|
||||
// Handle documents
|
||||
} else if ([".pdf"].includes(ext)) {
|
||||
return {
|
||||
type: "html",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user