Skip to content

fix(export): stop Obsidian hiding leading-dot note names - #2242

Closed
SyedFahad7 wants to merge 2 commits into
Graphify-Labs:v8from
SyedFahad7:fix/2205-obsidian-dotfile-notes
Closed

fix(export): stop Obsidian hiding leading-dot note names#2242
SyedFahad7 wants to merge 2 commits into
Graphify-Labs:v8from
SyedFahad7:fix/2205-obsidian-dotfile-notes

Conversation

@SyedFahad7

Copy link
Copy Markdown
Contributor

Summary

Fixes #2205.

Obsidian hides any note whose filename starts with ., so nodes labeled .env / .gitignore were written to the vault but never showed up (and wikilinks to them looked broken). safe_name now turns a leading-dot stem into dot-… via a shared _obsidian_safe_stem used by both the vault and canvas exporters. H1 / frontmatter still have the real label.

Test plan

safe_name left stems like .env intact, so the vault wrote .env.md which
Obsidian treats as a hidden file — invisible in the explorer and as
unresolved wikilinks. Prefix with dot- (shared _obsidian_safe_stem for
vault + canvas). True label stays in the note body.

Fixes Graphify-Labs#2205
Copilot AI review requested due to automatic review settings July 27, 2026 18:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Obsidian exports for nodes whose labels begin with a leading dot (e.g. .env, .gitignore) by ensuring the generated note/canvas filename stems don’t start with . (which Obsidian treats as hidden). It centralizes Obsidian-safe filename logic into a shared helper so both the vault exporter (to_obsidian) and canvas exporter (to_canvas) stay consistent.

Changes:

  • Add _obsidian_safe_stem() to generate Obsidian-safe filename stems (including dot- prefix for leading-dot labels) and keep the existing punctuation-only fallback (unnamed).
  • Replace duplicated inline safe_name() implementations in to_obsidian and to_canvas with the shared helper.
  • Apply the shared helper consistently to community note filenames and cross-community wikilinks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread graphify/export.py
Comment on lines +446 to +450
cleaned = re.sub(r"\.(md|mdx|qmd|markdown)$", "", cleaned, flags=re.IGNORECASE)
# Obsidian treats a leading-dot filename as a hidden file (#2205).
if cleaned.startswith("."):
cleaned = "dot-" + cleaned.lstrip(".")
# A stem of only punctuation (e.g. "@", "*", "#") survives the unsafe-char

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call — pushed a regression test for .env / .gitignore stems on both the vault notes and the canvas file nodes.

Assert .env / .gitignore become dot-env / dot-gitignore on disk and in
the canvas file nodes, so Obsidian cannot hide them again (Graphify-Labs#2205).
safishamsi added a commit that referenced this pull request Jul 28, 2026
….example regression test (#2205, #2184)

Follow-ups on the cherry-picked #2242/#2232: an all-dots label ('...') no
longer produces an empty 'dot-' Obsidian stem (falls back to 'unnamed'),
and the .env.example carve-out gets the regression test it shipped without
(templates graphable, real .env still sensitive, secrets/.env.example still dropped).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@safishamsi

Copy link
Copy Markdown
Collaborator

Thanks @SyedFahad7. Shipped in v0.9.29 (cherry-picked to v8), with a follow-up so an all-dots label falls back to 'unnamed'. Closed-unmerged here, but it's in the release: https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.29

@safishamsi safishamsi closed this Jul 28, 2026
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

Successfully merging this pull request may close these issues.

Obsidian export: nodes whose label starts with . produce notes Obsidian never displays

3 participants