mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-21 21:45:42 -05:00
style: apply prettier formatting to obsidian-highlight plugin files
This commit is contained in:
parent
3a7e0e5f9b
commit
8fb97a8002
@ -20,8 +20,8 @@ Plugin.ObsidianHighlight()
|
|||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
| Option | Type | Default | Description |
|
| Option | Type | Default | Description |
|
||||||
|--------|------|---------|-------------|
|
| ---------------- | -------- | ------------------ | ------------------------------------ |
|
||||||
| `highlightClass` | `string` | `"text-highlight"` | CSS class for the highlight `<span>` |
|
| `highlightClass` | `string` | `"text-highlight"` | CSS class for the highlight `<span>` |
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|||||||
@ -68,7 +68,11 @@ export const ObsidianHighlight: QuartzTransformerPlugin<Partial<Options>> = (use
|
|||||||
// Case 2: == at start/end with elements between (e.g. ==***text***==)
|
// Case 2: == at start/end with elements between (e.g. ==***text***==)
|
||||||
// First, split any "==" suffix/prefix from text nodes into separate nodes
|
// First, split any "==" suffix/prefix from text nodes into separate nodes
|
||||||
// so that all "==" markers are standalone text nodes
|
// so that all "==" markers are standalone text nodes
|
||||||
if (child.type === "text" && (child as Text).value.endsWith("==") && (child as Text).value.trim() !== "==") {
|
if (
|
||||||
|
child.type === "text" &&
|
||||||
|
(child as Text).value.endsWith("==") &&
|
||||||
|
(child as Text).value.trim() !== "=="
|
||||||
|
) {
|
||||||
const val = (child as Text).value
|
const val = (child as Text).value
|
||||||
const prefix = val.slice(0, -2)
|
const prefix = val.slice(0, -2)
|
||||||
const parts: RootContent[] = []
|
const parts: RootContent[] = []
|
||||||
@ -80,7 +84,11 @@ export const ObsidianHighlight: QuartzTransformerPlugin<Partial<Options>> = (use
|
|||||||
}
|
}
|
||||||
// Split "==text" prefix (e.g. "==text" at end of content before emphasis)
|
// Split "==text" prefix (e.g. "==text" at end of content before emphasis)
|
||||||
// This handles the case where text before emphasis starts with "=="
|
// This handles the case where text before emphasis starts with "=="
|
||||||
if (child.type === "text" && (child as Text).value.startsWith("==") && (child as Text).value.trim() !== "==") {
|
if (
|
||||||
|
child.type === "text" &&
|
||||||
|
(child as Text).value.startsWith("==") &&
|
||||||
|
(child as Text).value.trim() !== "=="
|
||||||
|
) {
|
||||||
const val = (child as Text).value
|
const val = (child as Text).value
|
||||||
const suffix = val.slice(2)
|
const suffix = val.slice(2)
|
||||||
const parts: RootContent[] = []
|
const parts: RootContent[] = []
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user