Skip to content

feat(importer): keep plain page wikilinks as native [[...]] syntax#1163

Merged
perber merged 4 commits into
mainfrom
feat/importer-native-wikilinks
Jun 19, 2026
Merged

feat(importer): keep plain page wikilinks as native [[...]] syntax#1163
perber merged 4 commits into
mainfrom
feat/importer-native-wikilinks

Conversation

@perber

@perber perber commented Jun 15, 2026

Copy link
Copy Markdown
Owner

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.

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.
Copilot AI review requested due to automatic review settings June 15, 2026 20:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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.

Comment thread internal/importer/content_transformer.go
Comment thread internal/importer/executor_test.go
perber added 3 commits June 19, 2026 15:57
…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.
@perber
perber merged commit 808c9df into main Jun 19, 2026
9 checks passed
@perber
perber deleted the feat/importer-native-wikilinks branch June 19, 2026 15:59
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.

2 participants