zoni / obsidian-export

Rust library and CLI to export an Obsidian vault to regular Markdown
Other
1.05k stars 84 forks source link

Support Obsidian aliases in frontmatter #117

Closed meermanr closed 2 years ago

meermanr commented 2 years ago

Obsidian aliases allow pages to have more than one title for the purposes of creating cross-references: Add aliases to note - Obsidian Help

A common use-case for this is creating a page with a long title such as "Expanded Acronyms for Everyone (EAfE).md" and then giving it a nice short alias to make it easy to link to from notes:

---
aliases: [EAfE]
---
# What are acronyms?
... content body here ...

You can then link to this page from other pages via [[EAfE]], which is a lot less typing.

I currently see a lot of the following errors when exporting my Obsidian vault:

Warning: Unable to find referenced note
    Reference: 'DBF'
    Source: '/Users/robmee01/Library/Mobile Documents/iCloud~md~obsidian/Documents/Work/Journal/FY22Q2/2022wk16.md'

and

Warning: Unable to find referenced note
    Reference: 'BFaaS'
    Source: '/Users/robmee01/Library/Mobile Documents/iCloud~md~obsidian/Documents/Work/Journal/FY21Q4/2022wk09.md'

Please can support for aliases be added, such that internal links to the page via its alias resolve to the intended page in the exported markdown?

zoni commented 2 years ago

Hi @meermanr, aliases are fully supported already (I use them heavily myself).

However, it looks like you have the obsidian alias syntax wrong above. A note with the filename Expanded Acronyms for Everyone (EAfE).md and aliases: [EAfE] would expand to the following when autocompleted within Obsidian:

[[Expanded Acronyms for Everyone (EAfE).md|EAfE]]`

Not:

[[EAfE]]

I just checked to make sure Obsidian's behavior didn't change there recently, but when I manually [[WikiLink]] an aliased note, it reports that as "WikiLink" is not created yet. Click to create. too.