feat(importer): keep plain page wikilinks as native [[...]] syntax#1163
Merged
Conversation
Plain page WikiLinks (no anchor, no asset) are now preserved as [[...]] so LeafWiki's native title-based resolution handles them — rename-aware and self-healing. Path-hinted links ([[Folder/Page]]) use the resolved slug path or fall back to slugified form. Anchor links and asset links continue to be converted to Markdown syntax. Excerpt extraction also updated to correctly strip path prefix from wikilink targets, returning only the final page title.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the importer’s link rewriting so that plain page WikiLinks are preserved as native [[...]] syntax (letting LeafWiki’s title-based resolution handle them), while keeping anchor links and asset links rendered as Markdown. It also adjusts excerpt extraction so path-hinted wikilinks contribute only their final segment to plain-text excerpts, and updates tests accordingly.
Changes:
- Preserve non-anchor, non-asset WikiLinks as
[[...]], using resolved slug paths for path-hinted links (or slugified fallback when unresolved). - Keep converting anchored WikiLinks to Markdown links since native WikiLinks don’t support anchors.
- Update excerpt extraction and importer/executor integration tests to reflect the new link preservation behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/importer/importer_integration_test.go | Updates integration expectations to match preserved [[...]] WikiLinks for pages. |
| internal/importer/executor_test.go | Updates executor tests to expect WikiLinks to remain [[...]] for page links. |
| internal/importer/content_transformer.go | Implements new WikiLink rewrite behavior (assets/anchors → Markdown; plain pages → [[...]]). |
| internal/importer/content_transformer_test.go | Expands/updates table-driven cases for preserved WikiLinks and path-hint slugification. |
| internal/core/excerpt/excerpt.go | Strips path prefixes from plain wikilink targets when generating plain-text excerpts. |
| internal/core/excerpt/excerpt_test.go | Adds coverage for path-hinted wikilinks in excerpts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…test name Add table-driven cases for [[https://...]] and [[//...]] wikilinks to confirm they are preserved unchanged. Rename stale test function that described the old "dead markdown link" fallback behaviour.
WikiLinks without anchors are now preserved as [[...]] instead of being converted to Markdown links. Update the HTTP integration test assertions to match the new expected output.
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.
Plain page WikiLinks (no anchor, no asset) are now preserved as [[...]] so LeafWiki's native title-based resolution handles them — rename-aware and self-healing. Path-hinted links ([[Folder/Page]]) use the resolved slug path or fall back to slugified form. Anchor links and asset links continue to be converted to Markdown syntax.
Excerpt extraction also updated to correctly strip path prefix from wikilink targets, returning only the final page title.