Steps to reproduce
- Start with a Sandbox Vault.
- Create one or more files with a native Mac app editor (e.g., Sublime or TextEdit) using filenames that contain diacritics (like ä, ü, ö, à, è, ò). Do not use the terminal for this.
- Save the files in the Sandbox Vault folder using Finder, e.g., in a new folder called “test.”
- Create the Python script
generate_wiki_links
:
#!/usr/bin/env python3
import os
import sys
def generate_wiki_links(folder_path):
"""
Generate a Markdown file with wiki links for all Markdown files in the specified folder.
Args:
folder_path (str): Path to the folder containing Markdown files.
Returns:
None
"""
# Check if the provided path is a directory
if not os.path.isdir(folder_path):
print(f"Error: The path '{folder_path}' is not a valid directory.")
return
# Prepare the output Markdown file
output_file_path = os.path.join(folder_path, "wiki_links.md")
with open(output_file_path, "w", encoding="utf-8") as output_file:
output_file.write("# Wiki Links\n\n")
# Iterate through all files in the directory
for filename in os.listdir(folder_path):
if filename.endswith(".md"): # Only process Markdown files
# Use the original filename directly
note_name = os.path.splitext(filename)[0] # Remove the .md extension
# Write the wiki link to the output file
output_file.write(f"- [[{note_name}]]\n")
print(f"Wiki links saved to: {output_file_path}")
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python generate_wiki_links.py <folder_path>")
sys.exit(1)
folder_path = sys.argv[1]
generate_wiki_links(folder_path)
- Run the script in the terminal:
python3 generate_wiki_links.py ~/Library/Application\ Support/obsidian/Obsidian\ Test/
- Open the
wiki_links.md
file in Obsidian. - Click one of the links.
- A new note will be created; clicking again will create another new note.
Did you follow the troubleshooting guide? [Y/N]
Y
Expected result
Open the exisiting note
Actual result
Creates a new note. However, this note isn’t connected to the wiki link either, because clicking again creates another new note.
Environment
SYSTEM INFO:
Obsidian version: v1.8.3
Installer version: v1.7.4
Operating system: Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 24.3.0
Login status: logged in
Language: de
Catalyst license: supporter
Insider build toggle: on
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 0
Plugins enabled: 0
Additional information
If you create a link to the document manually inside Obsidian, it will be encoded as NFC-normalized UTF-8 and will work correctly. This may be an edge case when creating links outside of Obsidian, but it should still function properly.
In the meantime, I learned that I could handle this at the script level for my Python script, but I’m unsure if this might cause issues elsewhere.