Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconsider implementation #19

Open
kometenstaub opened this issue Apr 3, 2023 · 0 comments
Open

Reconsider implementation #19

kometenstaub opened this issue Apr 3, 2023 · 0 comments

Comments

@kometenstaub
Copy link
Owner

if (!fullLink.includes('#')) {
currentLinkObject.link = fullLink;
// account for alias
if (aliasText !== fullLink) {
currentLinkObject.displayText = aliasText;
}
// account for uncreated files
if (relPath) {
currentLinkObject.relativePath = relPath.path;
}
}
// heading/block ref and maybe an alias, but not to the same file
else if (fullLink.includes('#') && fullLink.charAt(0) !== '#') {
const alias = aliasText;
const cleanLink = getLinkpath(fullLink);
currentLinkObject.link = fullLink;
currentLinkObject.cleanLink = cleanLink;
// it has an alias
if (!aliasText.includes('#') || !aliasText.includes('>')) {
currentLinkObject.displayText = alias;
}
// account for uncreated files
if (relPath) {
currentLinkObject.relativePath = relPath.path;
}
}
// heading/block ref to same file and maybe alias
else if (fullLink.charAt(0) === '#') {
currentLinkObject.link = fullLink;
currentLinkObject.relativePath = relativeFilePath;
currentLinkObject.cleanLink = displayName;
// account for alias
if (fullLink !== aliasText) {
currentLinkObject.displayText = aliasText;

https://github.com/obsidianmd/obsidian-api/blob/bceb489fc25ceba5973119d6e57759d64850f90d/obsidian.d.ts#L2618-L2627

https://github.com/obsidianmd/obsidian-api/blob/bceb489fc25ceba5973119d6e57759d64850f90d/obsidian.d.ts#L2359-L2367

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant