mirror of
https://github.com/kdnk/obsidian-automatic-linker.git
synced 2026-07-22 05:37:46 +00:00
Why: - Some notes need to keep raw URLs and avoid web title requests even when global URL title replacement is enabled. - A per-note frontmatter flag gives users local control without disabling other automatic linking behavior. What: - Add automatic-linker-disable-url-title frontmatter detection. - Skip URL title fetching and replacement when the flag is set on a note. - Document the frontmatter option and add regression coverage for the helper and plugin flow. - Record this repository's agent version-control instructions in AGENTS.md.
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
/**
|
|
* Check if the file has the "off" frontmatter property
|
|
*/
|
|
export const isLinkingOff = (
|
|
frontmatter: Record<string, unknown> | undefined,
|
|
): boolean => {
|
|
return (
|
|
frontmatter?.["automatic-linker-disabled"] === true
|
|
|| frontmatter?.["automatic-linker-off"] === true
|
|
)
|
|
}
|
|
|
|
/**
|
|
* Check if the file has the "scoped" frontmatter property
|
|
*/
|
|
export const isNamespaceScoped = (
|
|
frontmatter: Record<string, unknown> | undefined,
|
|
): boolean => {
|
|
return (
|
|
frontmatter?.["automatic-linker-restrict-namespace"] === true
|
|
|| frontmatter?.["automatic-linker-limited-namespace"] === true
|
|
|| frontmatter?.["automatic-linker-scoped"] === true
|
|
)
|
|
}
|
|
|
|
/**
|
|
* Check if the file has the "exclude" frontmatter property
|
|
*/
|
|
export const isLinkingExcluded = (
|
|
frontmatter: Record<string, unknown> | undefined,
|
|
): boolean => {
|
|
return (
|
|
frontmatter?.["automatic-linker-prevent-linking"] === true
|
|
|| frontmatter?.["automatic-linker-exclude"] === true
|
|
)
|
|
}
|
|
|
|
/**
|
|
* Check if the file disables URL title fetching/replacement
|
|
*/
|
|
export const isUrlTitleReplacementOff = (
|
|
frontmatter: Record<string, unknown> | undefined,
|
|
): boolean => {
|
|
return frontmatter?.["automatic-linker-disable-url-title"] === true
|
|
}
|