chore: fix stylistic issues in multiple files

This commit is contained in:
Kodai Nakamura 2025-12-20 20:57:13 +09:00
parent 2943d80742
commit 0b62af15cd
4 changed files with 11 additions and 14 deletions

View file

@ -64,9 +64,9 @@ export default class AutomaticLinkerPlugin extends Plugin {
}
/**
* Creates a LinkGenerator that uses Obsidian's generateMarkdownLink API.
* Falls back to default wikilink format if the file cannot be resolved.
*/
* Creates a LinkGenerator that uses Obsidian's generateMarkdownLink API.
* Falls back to default wikilink format if the file cannot be resolved.
*/
private createLinkGenerator(sourcePath: string): LinkGenerator {
return ({
linkPath,

View file

@ -44,13 +44,13 @@ describe("copy selection integration test", () => {
it("", () => {
const text = `
- hello
- hello
- hello [[world]]`
const withoutIndent = removeMinimalIndent(text)
const result = excludeLinks(withoutIndent)
const expected = `
- hello
- hello world`
- hello world`
expect(result).toBe(expected)
})
})

View file

@ -179,8 +179,8 @@ This is a test document with ${linkWords[0]} and ${linkWords[1]}.
\`\`\`javascript
function test() {
// This should not be processed: ${linkWords[2]}
return "${linkWords[3]}";
// This should not be processed: ${linkWords[2]}
return "${linkWords[3]}";
}
\`\`\`
@ -194,7 +194,7 @@ Here are some more references to ${linkWords[4]} and ${linkWords[5]}.
${generateLargeBody(10)}
Final paragraph mentions ${linkWords[9]} again.
`.trim()
`.trim()
const { candidateMap, trie } = buildCandidateTrieForTest({
files,

View file

@ -34,21 +34,18 @@ export interface ReplaceLinksOptions {
// Constants and Regular Expressions
const REGEX_PATTERNS = {
PROTECTED:
/(```[\s\S]*?```|`[^`]*`|\[\[[^\]]+\]\]|\[[^\]]+\]\([^)]+\)|\[[^\]]+\]|https?:\/\/[^\s]+)/g,
PROTECTED: /(```[\s\S]*?```|`[^`]*`|\[\[[^\]]+\]\]|\[[^\]]+\]\([^)]+\)|\[[^\]]+\]|https?:\/\/[^\s]+)/g,
DATE_FORMAT: /^\d{4}-\d{2}-\d{2}$/,
MONTH_NOTE: /^[0-9]{1,2}$/,
CJK: /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}]/u,
CJK_CANDIDATE:
/^[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\s\d]+$/u,
CJK_CANDIDATE: /^[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\s\d]+$/u,
KOREAN: /^[\p{Script=Hangul}]+$/u,
JAPANESE: /^[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\s\d]+$/u,
URL: /^(https?:\/\/[^\s]+)/,
PROTECTED_LINK: /^\s*(\[\[[^\]]+\]\]|\[[^\]]+\]\([^)]+\))\s*$/,
KOREAN_SUFFIX: /^(이다\.?)/,
KOREAN_PARTICLES: /^(는|은)/,
JAPANESE_PARTICLES:
/^(가|는|을|에|서|와|로부터|까지|보다|로|의|나|도|또한)/,
JAPANESE_PARTICLES: /^(가|는|을|에|서|와|로부터|까지|보다|로|의|나|도|또한)/,
TABLE_SEPARATOR: /^[|:\s-]+$/,
WORD_BOUNDARY: /[\p{L}\p{N}_/-]/u,
WHITESPACE: /[\t\n\r ]/,