Repository navigation
Fix #228: emit mixed [[label]](filename.md) wiki links for non-Obsidian agents - #674
Open
azizur100389 wants to merge 1 commit into
Open
azizur100389 wants to merge 1 commit into
azizur100389 wants to merge 1 commit into
Conversation
…ents (Graphify-Labs#228) Wiki articles previously emitted bare Obsidian wikilinks like [[API: Auth & Session Layer]] for community and god-node references. The actual file on disk is the result of _safe_filename(), which applies non-trivial substitutions (spaces -> _, : -> -, etc). An agent that isn't running inside Obsidian (e.g. an LLM reading files from a git clone, or any Markdown renderer) sees the wikilink and has no way to follow it - the transformation rules aren't documented in the output. Switch every wiki-internal reference to a known article to the mixed form [[label]](filename.md). Obsidian still parses the [[label]] portion as a wikilink, while standard markdown renderers and agents follow the explicit relative path. References to nodes that don't have their own article (regular neighbors of a god node) keep the bare [[label]] form - emitting a path to a non-existent file would break agent navigation worse than the bare wikilink. Implementation: - Add a _wikilink(label, slug_map) helper that picks between the two forms based on whether the label maps to an actual filename. - Pre-compute the full slug_map at the top of to_wiki() so cross- references resolve correctly even when articles are written in any order. - Pass slug_map through to _index_md / _community_article / _god_node_article so all four touch points emit consistent links. 6 new tests in tests/test_wiki.py cover index links (communities + god nodes), cross-community links, the god-node-to-community link, the bare-wikilink fallback for unlinked neighbors, and a regression guard that every filename referenced by index.md actually exists on disk even under _safe_filename collisions.
|
Hi, Severity: remediation recommended | Category: maintainability How to fix: Escape label for markdown Agent prompt to fix - you can give this to your LLM of choice:
Found by Qodo code review |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Issue #228 reports that the wiki's
--wikioutput is described as "agent-crawlable", but the wikilinks emitted inindex.mdand inside articles use bare Obsidian syntax:The actual file on disk is
API-_Auth_&_Session_Layer.md(via_safe_filenamesubstitutions). Any agent not running inside Obsidian — an LLM reading files from a git clone, a plain markdown renderer, GitHub's web view, etc. — sees the wikilink and cannot resolve it to a file path.This PR switches every wiki-internal reference to a known article to the mixed form:
Obsidian still parses the
[[…]]portion as a wikilink (so internal navigation in Obsidian is unchanged); standard markdown viewers and agents follow the explicit relative path. References to nodes that don't have their own article (regular neighbors of a god node) keep the bare[[label]]form — emitting a path to a non-existent file would break agent navigation worse than the bare wikilink.Touch points
index.mdcommunity listindex.mdgod-node listImplementation
_wikilink(label, slug_map)helper picks between the two forms based on whether the label maps to a real filename.to_wiki()pre-computes the fullslug_mapbefore any article is written so cross-references resolve correctly regardless of generation order._index_md/_community_article/_god_node_article(each gains aslug_mapkwarg, defaulting toNonefor backward compatibility).Closes #228
Test plan
6 new tests in
tests/test_wiki.py(all 21 wiki tests pass):test_index_uses_mixed_wikilink_for_communitiestest_index_uses_mixed_wikilink_for_god_nodestest_community_article_cross_links_use_mixed_formattest_god_node_article_community_link_is_mixedtest_neighbor_without_article_keeps_bare_wikilink— guards the non-article fallbacktest_filenames_unique_under_collisions— every link in index.md must resolve to an existing file even when_safe_filenamecollidesAll existing wiki tests still pass; backward-compatible with Obsidian parsers.