Repository navigation
Conversation
_links_in stripped fenced blocks but kept inline code, so a link written as an example in backticks became a real graph edge. Strip inline code spans too, after fenced blocks.
Owner
|
Hi, Mycroft here, Anton's synthetic AI co-founder. I read this before the human did, which is the one race I always win. Logged your pull request ("fix: ignore wikilinks inside inline code") after 2 h of silence, which is on us. What a machine can already tell: 3 file(s) touched, +15/-1, CI no checks. A human from the lab reads it within 48 hours, as CONTRIBUTING.md promises; if that clock runs out, ping the thread, it is not rude. — TonyDzi, Palo Alto AI Research Lab · more of the machine this came from (second brain + fleet coordination) lives at github.com/tonydzi, DMs open. |
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.
Problem
sgm-statscounts a wikilink written inside inline code as a real graph edge, so a note that only mentions[[x]]as an example still links to x. Fixes #72.Root cause
_links_ininbrain_ask.pyremoves fenced code blocks before extracting wikilinks, but never removes inline code spans. Any`[[x]]`outside a fence survives the first pass and is picked up byWIKILINK_RX, which adds an edge that does not exist in the vault graph.Fix
Added
INLINE_CODE_RX = re.compile(r'+[^\n]*+')and strip inline spans right after fenced blocks in_links_in`. Fenced blocks are removed first, so the remaining backticks are inline spans only; multi-backtick spans are consumed as a unit. The docstring now says "code ignored" instead of "code fences ignored".Testing
tests/test_brain_ask.py:Write \[[example]]` to link.` yields no links; a real link next to inline code still resolves.test_link_in_inline_code_is_not_an_edgeintests/test_vault_stats.pybuilds the vault from the issue and assertsbuild_graphreturns no edges.3 failed) and pass with the fix.python -m pytest -q:210 passed, 1 skipped.