feat(wiki): internal wikilinks with [[Page Name]] syntax #666

Closed
opened 2026-06-21 06:31:56 +00:00 by jmiller · 0 comments
Owner

Summary

Add Wikipedia-style [[Page Name]] wikilink syntax to wiki pages, with support for display text, folder paths, and red links for non-existent pages.

Current State

  • Wiki pages must use standard markdown [text](url) syntax for internal links
  • No special handling for inter-wiki-page links
  • No visual indicator for broken/non-existent page links

Proposed Syntax

Syntax Rendered As
[[Page Name]] Link to wiki page "Page Name"
[[Page Name|Display Text]] Link showing "Display Text" pointing to "Page Name"
[[folder/Page Name]] Link to page in folder (leverages existing folder structure)
[[#Section]] Anchor link to section on current page
[[Page Name#Section]] Link to specific section on another page

Red Links

Pages that don't exist should render with a distinct style (red text, like Wikipedia), linking to the create page URL (?action=_new&title=Page+Name). This helps wiki authors identify missing content.

Implementation

Markdown Extension

  • Add a custom renderer in modules/markup/markdown/ that intercepts [[...]] patterns before standard markdown processing
  • During render, check each wikilink against the page list from the wiki git repo
  • Mark non-existent pages with a CSS class (.wikilink-new) for red link styling

Backend

  • routers/web/repo/wiki.go renderViewPage() — pass the page list to the render context so the wikilink renderer can check existence
  • The renderer needs access to the wiki commit to call GetTreeEntryByPath() for each linked page

Files to Modify

File Change
modules/markup/markdown/ New wikilink pre-processor or goldmark extension
routers/web/repo/wiki.go Pass page list to render context
web_src/css/ .wikilink-new red link styling

Wikipedia Parity

This is Wikipedia's signature feature — [[internal links]] are the backbone of wiki navigation and content discovery.

## Summary Add Wikipedia-style `[[Page Name]]` wikilink syntax to wiki pages, with support for display text, folder paths, and red links for non-existent pages. ## Current State - Wiki pages must use standard markdown `[text](url)` syntax for internal links - No special handling for inter-wiki-page links - No visual indicator for broken/non-existent page links ## Proposed Syntax | Syntax | Rendered As | |--------|-------------| | `[[Page Name]]` | Link to wiki page "Page Name" | | `[[Page Name\|Display Text]]` | Link showing "Display Text" pointing to "Page Name" | | `[[folder/Page Name]]` | Link to page in folder (leverages existing folder structure) | | `[[#Section]]` | Anchor link to section on current page | | `[[Page Name#Section]]` | Link to specific section on another page | ## Red Links Pages that don't exist should render with a distinct style (red text, like Wikipedia), linking to the create page URL (`?action=_new&title=Page+Name`). This helps wiki authors identify missing content. ## Implementation ### Markdown Extension - Add a custom renderer in `modules/markup/markdown/` that intercepts `[[...]]` patterns before standard markdown processing - During render, check each wikilink against the page list from the wiki git repo - Mark non-existent pages with a CSS class (`.wikilink-new`) for red link styling ### Backend - `routers/web/repo/wiki.go` `renderViewPage()` — pass the page list to the render context so the wikilink renderer can check existence - The renderer needs access to the wiki commit to call `GetTreeEntryByPath()` for each linked page ### Files to Modify | File | Change | |------|--------| | `modules/markup/markdown/` | New wikilink pre-processor or goldmark extension | | `routers/web/repo/wiki.go` | Pass page list to render context | | `web_src/css/` | `.wikilink-new` red link styling | ## Wikipedia Parity This is Wikipedia's signature feature — `[[internal links]]` are the backbone of wiki navigation and content discovery.
jmiller added the feature: wiki label 2026-06-21 06:31:56 +00:00
Sign in to join this conversation.