Installation
VSIX
IPE NEXT plugin
Install IPE first by following the IPE installation guide,
then add the registry in InPageEdit Settings → Plugin Store:
https://minortex.github.io/WikiPreviewer/ipe-plugin/registry.json
Development version:
https://minortex.github.io/WikiPreviewer/ipe-plugin/dev/registry.json
After installing:
- Allow access to local devices so the plugin can connect to the local service the extension starts.
- To jump to definitions from VSCode, allow the page to open in the browser the first time.
Usage
The extension leads, because it is what actually holds the user's unsaved changes; the web page only pushes site content and renders it, attaching to the extension so it can be closed at any time.
Web side:
- Click the extra fifth grey button to edit the whole page.
- Click "Cancel": with no changes the original page is restored and the editor closes automatically; with changes it asks whether to save.
- Multiple tabs of the same page can attach to one editing session: editor updates are pushed to every attached tab, and saving or cancelling in any tab ends that session.
Extension side:
- Editing commands:
- Close editor / close editing session:
- When the content changed, ask whether to save or discard.
- When nothing changed, close the editor tab and delete the temp file directly.
- Closing also tries to close the browser page spawned for the session.
- If the editor exits unexpectedly and is reopened, editor tabs restored by VSCode keep working as sessions.
- Restore editing draft:
- If a draft was not restored for some reason, read it from the local file and restore the editing session manually.
- Save the current file via IPE:
- Same as "Save changes" on the web side.
- Open the current page in the browser.
Features
- If an edit conflict occurs on save, the conflict markers are written into the editor for manual merging.
- With a page and one of its transcluded templates open at the same time, editing and saving the template file re-renders the page with the updated template automatically.
If you want to understand the four state transitions...
Expand
stateDiagram-v2
direction LR
state "Start (begin editing)" as Start
state "Draft" as Draft
state "Attached (browser connected)" as Attached
state "Detached (browser disconnected)" as Detached
state "Awaiting (waiting for confirmation)" as Awaiting
state "Completed (one edit finished)" as Completed
state "Extension service offline" as Offline
Start --> Attached
Detached --> Attached: browser query / attach
Attached --> Detached: browser closed / WebSocket close
Attached --> Draft: editor close (VSC stays open)<br/>save failed (file kept)
Draft --> Attached: restore draft / query takeover
Attached --> Awaiting: finish, saved
Awaiting --> Completed: save-confirmed + revid, temp file deleted
Awaiting --> Attached: conflict, content merged into the editor
Offline --> Attached: restore the editing session manually
Attached --> Offline: editor closed unexpectedly
| State |
Meaning |
Attached |
The browser WebSocket is connected and the current window is being edited |
Detached |
The session still exists, but the browser connection has dropped |
Draft |
The VSCode editor was closed; the temp file is kept as a draft |
Awaiting |
Submitted successfully, waiting for the browser to confirm with the new revision id (revid); the temp file is deleted only after that confirmation |
Multiple wikis
The first time a page is sent from the web side, the extension remembers that wiki site.
- Once connected to the extension, the web-side script requests the local site's
siteinfo with the browser's login state and pushes it to the extension through the register-wiki message.
- The command palette lists the wikis that have been connected.
Language features
Powered by wikiparser-node: diagnostics and quick fixes, syntax/semantic highlighting, completion, hover, signature help, folding, outline, internal links, definitions/references/rename.
Beyond wikiparser's context completion, completion also offers structural snippets: headings, tables, quotes, tags, redirects, signatures, comments and more. Accepting a parser-function completion (#if, #switch, #invoke, …) generates a skeleton with parameter placeholders. {{{, {{, [[, {|, <!-- and -{ auto-close; no snippets are offered inside <nowiki>, <pre>, comments and similar regions.
Position sync
The web page follows the cursor position, and double-clicking in the page syncs that position back to the editor.
Heuristic matching, because Parsoid breaks the layout and DSR has almost no wiki support for precise positioning.
- Editor → preview: AST text node + section + occurrence, located inside the same section of the preview.
- Preview → source: text at the click point + section + occurrence, looked up in reverse; falls back to line-by-line text matching on failure.
- Textless templates: matched against expanded blocks by template name/parameters/section/index; falls back to highlighting the whole section.
Most cases do jump, but complex layouts can still break forward or reverse matching.
UI language
Runtime messages have English as their source and switch automatically with VS Code's display language through vscode.l10n; Simplified Chinese is bundled today (l10n/bundle.l10n.zh-cn.json). Manifest text such as command titles and settings uses package.nls*.json.
To add a language, copy l10n/bundle.l10n.zh-cn.json to the matching locale file (e.g. bundle.l10n.ja.json) and translate the values; keys must match the English source strings exactly.