Right now, if the cite key contains unsafe characters for a path, the displayed title for the Markdown link has those characters replaced with _. This is not necessary and obscures the actual cite key. Details below.
The function getTitleForCitekey creates a title for the literature note, in part by replacing unsafe characters in the cite key:
|
getTitleForCitekey(citekey: string): string { |
|
const unsafeTitle = this.literatureNoteTitleTemplate( |
|
this.library.getTemplateVariablesForCitekey(citekey), |
|
); |
|
return unsafeTitle.replace(DISALLOWED_FILENAME_CHARACTERS_RE, '_'); |
|
} |
The function insertLiteratureNoteLink uses this title to create the link to the note:
|
const title = this.getTitleForCitekey(citekey); |
|
|
|
let linkText: string; |
|
if (useMarkdown) { |
|
const uri = encodeURI( |
|
this.app.metadataCache.fileToLinktext(file, '', false), |
|
); |
|
linkText = `[${title}](${uri})`; |
|
} else { |
|
linkText = `[[${title}]]`; |
|
} |
This is correct for Wiki style links, which must use the path name, but this is not necessary for Markdown links, which could use the actual cite key as the displayed title while still using the safe title for the path name.
Right now, if the cite key contains unsafe characters for a path, the displayed title for the Markdown link has those characters replaced with
_. This is not necessary and obscures the actual cite key. Details below.The function
getTitleForCitekeycreates a title for the literature note, in part by replacing unsafe characters in the cite key:obsidian-citation-plugin/src/main.ts
Lines 306 to 311 in 2edeece
The function
insertLiteratureNoteLinkuses this title to create the link to the note:obsidian-citation-plugin/src/main.ts
Lines 383 to 393 in 2edeece
This is correct for Wiki style links, which must use the path name, but this is not necessary for Markdown links, which could use the actual cite key as the displayed title while still using the safe title for the path name.