WikiLabs DevTools Plugin — Browser-Side Developer Tools for TiddlyWiki

Experimental – Experimental – Experimental – Experimental – Experimental

Only works with v5.4.0-prerelease and later

Hi everyone,

I’d like to share the DevTools plugin from the WikiLabs collection. It adds browser-side inspection capabilities to TiddlyWiki — hover tooltips, a context menu, a source viewer, and a variable inspector. It helps you understand how rendered output maps back to wikitext source, across transclusion boundaries, macros, procedures, and list widgets.

Demo & docs: DevTools — For TiddlyWiki developers

Quick Start

  1. Install the plugin from the demo page

  2. Go to Control Panel → Settings → Source Position Tracking and enable it

  3. Save and reload the page

  4. Hover any element to see its source position

  5. Right-click any element for the full context menu

Features

Hover Tooltip

Hovering over any rendered element shows a tooltip after a short delay (400ms). It displays:

  • Source position — e.g., L3 @ GettingStarted

  • Transclusion caller chain — traces back through ViewTemplate, PageTemplate, etc.

  • Context — shows currentTiddler when it differs from the source tiddler (useful for list widgets)

The hovered element gets an orange dashed outline. Parent outlines are hidden when a child is hovered, so only the innermost element is highlighted.

Context Menu

Right-clicking any tracked element opens a custom context menu (use Ctrl+right-click for the native browser menu).

The menu header shows the source position with icon buttons:

  • Pencil — opens the tiddler in edit mode and auto-selects the corresponding source text

  • Eye — appends the source code to the Source Viewer panel

Below the header:

  • Copy tiddler title / Copy source position — clipboard actions

  • Inspect variables — opens the Variable Inspector

  • Open tiddlerTitle — navigates to the source tiddler

  • Open ← callerTitle — one entry per caller in the transclusion chain

Variable Inspector

Shows all variables in scope at a specific element. Open multiple inspectors simultaneously, each with its own colour.

  • Type badgesvar, macro, proc, def, fn, widget with colour coding

  • Grouping — variables grouped by source tiddler, local scope first

  • Smart filtering — type keywords match the badge; other terms match name/value

  • Previews — eye icon toggles inline previews for tiddler references and definitions

  • Linked panels — filter, size, and previews can be synced across all open inspectors

  • Live updates — variables re-collected after each TW page refresh

  • Macro substitution — evaluated body shown with green (matched) / red (missing) colour coding

Source Viewer

A floating, draggable, resizable panel that accumulates source code entries. Click the eye icon in the context menu to add entries.

Key features:

  • Deduplication — same source from different contexts adds a new header above the existing code block instead of duplicating it

  • Origin highlighting — hover an entry header to blink the origin element 3× in red, then show a steady blue outline

  • Procedure extraction — if the source is inside a \procedure, \define, \widget, or \function, the entire definition is shown

  • Supports up to 100 entries; layout is stored in-memory (no store writes)

How It Works

The plugin uses TiddlyWiki’s hook system — zero overhead when disabled:

  • th-dom-rendering-element — tracks HTML elements

  • th-dom-rendering-link — tracks link elements

  • th-dom-rendering-codeblock — tracks code blocks

  • Monkey-patches the transclude widget to track source context across transclusion boundaries

Line numbers are file-ready — they include the .tid file header offset and macro body offset, so they match exactly what your text editor shows. No core file modifications are required.

Configuration

Tiddler Values Description
$:/config/wikilabs/SourcePositionTracking yes / no Master switch (default: yes)

Status

The plugin is currently marked as EXPERIMENTAL. Feedback, bug reports, and ideas are very welcome!

3 Likes

Just a placeholder for additional info

Mario, This looks wonderful, I look forward to checking it out.

It seems to me it would help people learning TiddlyWiki at a deeper level and some features may be useful to ongoing development of tools, reverse engineering and self documentation (or less documentation) because the methods used can be quickly (re)determined.

I think one interesting feature will be the “jump to source”, which probably could be useful as a stand-alone feature. … It will need some code changes in the core. At the moment is a “monkey patch” and therefore could be considered a bit hacky.

So v5.5.0 may have a possibility to “Edit at position”, even if the content tiddler is a transclusion. It is able to follow that “trail” and open the right tiddler.