mirror of
https://github.com/bramses/obsidian-stack-overflow.git
synced 2026-07-22 06:40:29 +00:00
24 lines
No EOL
1.4 KiB
TypeScript
24 lines
No EOL
1.4 KiB
TypeScript
// https://github.com/zolrath/obsidian-auto-link-title/blob/main/settings.ts
|
|
export interface AutoLinkTitleSettings {
|
|
regex: RegExp;
|
|
lineRegex: RegExp;
|
|
linkRegex: RegExp;
|
|
linkLineRegex: RegExp;
|
|
imageRegex: RegExp;
|
|
shouldReplaceSelection: boolean;
|
|
enhanceDefaultPaste: boolean;
|
|
}
|
|
|
|
export const DEFAULT_SETTINGS: AutoLinkTitleSettings = {
|
|
regex:
|
|
/^(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})$/i,
|
|
lineRegex:
|
|
/(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/gi,
|
|
linkRegex:
|
|
/^\[([^\[\]]*)\]\((https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})\)$/i,
|
|
linkLineRegex:
|
|
/\[([^\[\]]*)\]\((https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})\)/gi,
|
|
imageRegex: /\.(gif|jpe?g|tiff?|png|webp|bmp|tga|psd|ai)$/i,
|
|
shouldReplaceSelection: true,
|
|
enhanceDefaultPaste: true,
|
|
}; |