mirror of
https://github.com/kdnk/obsidian-automatic-linker.git
synced 2026-07-22 05:37:46 +00:00
chore: update buildCandidateTrie signature
This commit is contained in:
parent
16207925a8
commit
1979d8e4ed
3 changed files with 7 additions and 4 deletions
|
|
@ -72,7 +72,7 @@ export default class AutomaticLinkerPlugin extends Plugin {
|
|||
body: fileContent.slice(contentStart),
|
||||
linkResolverContext: {
|
||||
filePath: activeFile.path.replace(/\.md$/, ""),
|
||||
trie: this.trie ?? buildCandidateTrie([]).trie,
|
||||
trie: this.trie ?? buildCandidateTrie([], undefined).trie,
|
||||
candidateMap: this.candidateMap ?? new Map(),
|
||||
},
|
||||
settings: {
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
export { getEffectiveNamespace, replaceLinks } from "./replace-links";
|
||||
export { replaceLinks } from "./replace-links";
|
||||
export type { ReplaceLinksOptions } from "./types";
|
||||
|
|
|
|||
|
|
@ -25,7 +25,10 @@ export interface TrieNode {
|
|||
* If the path starts with one of the baseDir (e.g. "pages/"), the directory immediately
|
||||
* under the baseDir is considered the effective namespace.
|
||||
*/
|
||||
export const getEffectiveNamespace = (path: string, baseDir?: string): string => {
|
||||
export const getEffectiveNamespace = (
|
||||
path: string,
|
||||
baseDir?: string,
|
||||
): string => {
|
||||
const prefix = baseDir + "/";
|
||||
if (baseDir) {
|
||||
if (path.startsWith(prefix)) {
|
||||
|
|
@ -67,7 +70,7 @@ export interface CandidateData {
|
|||
|
||||
export const buildCandidateTrie = (
|
||||
allFiles: PathAndAliases[],
|
||||
baseDir?: string,
|
||||
baseDir: string | undefined,
|
||||
) => {
|
||||
// Process candidate strings from file paths.
|
||||
type Candidate = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue