mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 21:34:06 -06:00
Popover fixes
This commit is contained in:
parent
8ef1d9582b
commit
ecaec9b8cb
@ -4,6 +4,14 @@ title: Configuration
|
|||||||
|
|
||||||
Quartz is meant to be extremely configurable, even if you don't know any coding. Most of the configuration you should need can be done by just editing `quartz.config.ts` or changing [[layout|the layout]] in `quartz.layout.ts`.
|
Quartz is meant to be extremely configurable, even if you don't know any coding. Most of the configuration you should need can be done by just editing `quartz.config.ts` or changing [[layout|the layout]] in `quartz.layout.ts`.
|
||||||
|
|
||||||
|
[[hosting#^123456]]
|
||||||
|
|
||||||
|
[[#general-configuration]]
|
||||||
|
|
||||||
|
[[#^test]]
|
||||||
|
|
||||||
|
[[configuration#^test]]
|
||||||
|
|
||||||
> [!tip]
|
> [!tip]
|
||||||
> If you edit Quartz configuration using a text-editor that has TypeScript language support like VSCode, it will warn you when you you've made an error in your configuration, helping you avoid configuration mistakes!
|
> If you edit Quartz configuration using a text-editor that has TypeScript language support like VSCode, it will warn you when you you've made an error in your configuration, helping you avoid configuration mistakes!
|
||||||
|
|
||||||
@ -76,7 +84,7 @@ plugins: {
|
|||||||
- [[tags/plugin/filter|Filters]] **filter** content (e.g. filtering out drafts)
|
- [[tags/plugin/filter|Filters]] **filter** content (e.g. filtering out drafts)
|
||||||
- [[tags/plugin/emitter|Emitters]] **reduce** over content (e.g. creating an RSS feed or pages that list all files with a specific tag)
|
- [[tags/plugin/emitter|Emitters]] **reduce** over content (e.g. creating an RSS feed or pages that list all files with a specific tag)
|
||||||
|
|
||||||
You can customize the behaviour of Quartz by adding, removing and reordering plugins in the `transformers`, `filters` and `emitters` fields.
|
You can customize the behaviour of Quartz by adding, removing and reordering plugins in the `transformers`, `filters` and `emitters` fields. ^test
|
||||||
|
|
||||||
> [!note]
|
> [!note]
|
||||||
> Each node is modified by every transformer _in order_. Some transformers are position sensitive, so you may need to pay particular attention to whether they need to come before or after certain other plugins.
|
> Each node is modified by every transformer _in order_. Some transformers are position sensitive, so you may need to pay particular attention to whether they need to come before or after certain other plugins.
|
||||||
|
|||||||
@ -34,7 +34,7 @@ To add a custom domain, check out [Cloudflare's documentation](https://developer
|
|||||||
|
|
||||||
## GitHub Pages
|
## GitHub Pages
|
||||||
|
|
||||||
In your local Quartz, create a new file `quartz/.github/workflows/deploy.yml`.
|
In your local Quartz, create a new file `quartz/.github/workflows/deploy.yml`. ^123456
|
||||||
|
|
||||||
```yaml title="quartz/.github/workflows/deploy.yml"
|
```yaml title="quartz/.github/workflows/deploy.yml"
|
||||||
name: Deploy Quartz site to GitHub Pages
|
name: Deploy Quartz site to GitHub Pages
|
||||||
|
|||||||
@ -34,7 +34,7 @@ async function mouseEnterHandler(
|
|||||||
thisUrl.hash = ""
|
thisUrl.hash = ""
|
||||||
thisUrl.search = ""
|
thisUrl.search = ""
|
||||||
const targetUrl = new URL(link.href)
|
const targetUrl = new URL(link.href)
|
||||||
const hash = decodeURIComponent(targetUrl.hash)
|
let hash = decodeURIComponent(targetUrl.hash)
|
||||||
targetUrl.hash = ""
|
targetUrl.hash = ""
|
||||||
targetUrl.search = ""
|
targetUrl.search = ""
|
||||||
|
|
||||||
@ -82,6 +82,17 @@ async function mouseEnterHandler(
|
|||||||
const contents = await response.text()
|
const contents = await response.text()
|
||||||
const html = p.parseFromString(contents, "text/html")
|
const html = p.parseFromString(contents, "text/html")
|
||||||
normalizeRelativeURLs(html, targetUrl)
|
normalizeRelativeURLs(html, targetUrl)
|
||||||
|
// strip all IDs from elements to prevent duplicates on same-page links
|
||||||
|
if (thisUrl.pathname === targetUrl.pathname) {
|
||||||
|
html.querySelectorAll("[id]").forEach((el) => {
|
||||||
|
const targetID = `popover-${el.id}`
|
||||||
|
const targetLink = hash.startsWith("#popover")
|
||||||
|
? hash
|
||||||
|
: `#popover-${hash.slice(1).replace("^", "").replace("%5E", "")}`
|
||||||
|
el.id = targetID
|
||||||
|
hash = targetLink
|
||||||
|
})
|
||||||
|
}
|
||||||
const elts = [...html.getElementsByClassName("popover-hint")]
|
const elts = [...html.getElementsByClassName("popover-hint")]
|
||||||
if (elts.length === 0) return
|
if (elts.length === 0) return
|
||||||
|
|
||||||
|
|||||||
@ -119,6 +119,7 @@ export const wikilinkRegex = new RegExp(
|
|||||||
)
|
)
|
||||||
|
|
||||||
export const blockReferenceEscapeRegex = new RegExp(/[\s\#]\^([\w-]+)[\s\n\]]/g)
|
export const blockReferenceEscapeRegex = new RegExp(/[\s\#]\^([\w-]+)[\s\n\]]/g)
|
||||||
|
export const blockReferenceCurrentPageRegex = new RegExp(/(\[\[\#\^|\]\(\#\^)/g)
|
||||||
|
|
||||||
// ^\|([^\n])+\|\n(\|) -> matches the header row
|
// ^\|([^\n])+\|\n(\|) -> matches the header row
|
||||||
// ( ?:?-{3,}:? ?\|)+ -> matches the header row separator
|
// ( ?:?-{3,}:? ?\|)+ -> matches the header row separator
|
||||||
@ -193,6 +194,10 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>>
|
|||||||
return value.replace(capture, `block-${capture}`)
|
return value.replace(capture, `block-${capture}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
src = src.replace(blockReferenceCurrentPageRegex, (value, capture) => {
|
||||||
|
return value.replace(capture, capture.slice(0, -1))
|
||||||
|
})
|
||||||
|
|
||||||
// replace all other wikilinks
|
// replace all other wikilinks
|
||||||
src = src.replace(wikilinkRegex, (value, ...capture) => {
|
src = src.replace(wikilinkRegex, (value, ...capture) => {
|
||||||
const [rawFp, rawHeader, rawAlias]: (string | undefined)[] = capture
|
const [rawFp, rawHeader, rawAlias]: (string | undefined)[] = capture
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user