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]]
|
- `highlight`: internal link background, highlighted text, [[syntax highlighting|highlighted lines of code]]
|
||||||
- `textHighlight`: markdown highlighted text background
|
- `textHighlight`: markdown highlighted text background
|
||||||
- `optimizeImages`: whether to optimize images for web serving when building Quartz. If this is set to `true`:
|
- `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.
|
- 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.
|
- 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 { FullSlug, getFileExtension, isAbsoluteURL, RelativeURL } from "../../util/path"
|
||||||
import { parseSelector } from "hast-util-parse-selector"
|
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
|
* 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.
|
* Add this plugin after all Markdown parser plugins in quartz.config.
|
||||||
*/
|
*/
|
||||||
export const Images: QuartzTransformerPlugin<Partial<Options>> = (userOpts) => {
|
export const Images: QuartzTransformerPlugin<Partial<Options>> = (userOpts) => {
|
||||||
|
//@ts-ignore
|
||||||
const opts = { ...defaultOptions, ...userOpts }
|
const opts = { ...defaultOptions, ...userOpts }
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -228,7 +228,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>>
|
|||||||
// embed cases
|
// embed cases
|
||||||
if (value.startsWith("!")) {
|
if (value.startsWith("!")) {
|
||||||
const ext: string = path.extname(fp).toLowerCase()
|
const ext: string = path.extname(fp).toLowerCase()
|
||||||
let url = slugifyFilePath(fp as FilePath)
|
const url = slugifyFilePath(fp as FilePath)
|
||||||
|
|
||||||
// Handle images
|
// Handle images
|
||||||
if (supportedImageExts.has(ext)) {
|
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)) {
|
} else if ([".mp4", ".webm", ".ogv", ".mov", ".mkv"].includes(ext)) {
|
||||||
return {
|
return {
|
||||||
type: "html",
|
type: "html",
|
||||||
value: `<video src="${url}" controls></video>`,
|
value: `<video src="${url}" controls></video>`,
|
||||||
}
|
}
|
||||||
// Handle audio
|
// Handle audio
|
||||||
} else if (
|
} else if (
|
||||||
[".mp3", ".webm", ".wav", ".m4a", ".ogg", ".3gp", ".flac"].includes(ext)
|
[".mp3", ".webm", ".wav", ".m4a", ".ogg", ".3gp", ".flac"].includes(ext)
|
||||||
) {
|
) {
|
||||||
@ -264,7 +264,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>>
|
|||||||
type: "html",
|
type: "html",
|
||||||
value: `<audio src="${url}" controls></audio>`,
|
value: `<audio src="${url}" controls></audio>`,
|
||||||
}
|
}
|
||||||
// Handle documents
|
// Handle documents
|
||||||
} else if ([".pdf"].includes(ext)) {
|
} else if ([".pdf"].includes(ext)) {
|
||||||
return {
|
return {
|
||||||
type: "html",
|
type: "html",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user