$ show TiddlyWiki/TiddlyWiki5
TiddlyWiki5 is a mature, extensible personal wiki application that runs entirely as a single HTML file in the browser or as a Node.js server. It manages content as individual 'tiddlers' — small, addressable pieces of text with metadata — and provides a powerful custom filter language for querying, transforming, and aggregating them. The application features a widget-based UI rendering engine, a pluggable wiki-text parser with dozens of rules, a built-in HTTP server with REST-like endpoints, encryption, and extensive integration plugins (geospatial maps via Leaflet/Turf, math typesetting via KaTeX, Markdown parsing, CodeMirror editing, QR codes, etc.). The architecture is highly modular: core functionality is implemented via module types (widgets, filter operators, parser rules, startup hooks, saver backends) that can be extended or overridden by plugins. The codebase has been continuously developed since 2011 and supports both client-side single-page application mode and server-side wiki mode. Despite its impressive extensibility and long history, the codebase shows signs of technical drift. The boot kernel (boot/boot.js) is a large monolithic file that mixes utility functions, the wiki store, module loading, and platform-specific startup logic. Many third-party libraries (e.g., JSZip v2.6.1, Leaflet.markercluster 1.5.3, minified CodeMirror modes) are vendored and outdated, requiring manual patching. The code style is inconsistent, with some modules using modern ES6+ features while others remain in ES5. The filter language and widget infrastructure are well-architected and reusable, but the tight coupling between core modules makes extraction for external use non-trivial. The project remains actively maintained with frequent commits, a large community, and an extensive test suite, making it a solid foundation for knowledge management applications, though significant refactoring would be needed to bring it to contemporary best practices.
The LLM identified 3 files worth highlighting for reuse:
The filter language parser, compiler, and executor. This module defines TiddlyWiki's core query language, parsing filter expressions into an AST of operators with suffixes, parameters, and run prefixes (e.g., :reduce, :map, :sort, :cascade). It supports caching of compiled filters (up to 2000 entries), recursion detection, and execution in a widget context for variable resolution. The design is cleanly separated: parseFilter(), compileFilter(), and filterTiddlers() are independent functions that could be extracted as a standalone DSL engine for any structured data store.
A performant doubly-linked list with indexed operations (pushTop, insertBefore, remove, indexOf, etc.). It maintains an internal index object for O(1) lookups by value, while supporting positional operations. The implementation handles edge cases like empty lists, single elements, and duplicate detection. This utility is self-contained (no internal dependencies) and could be extracted as a standalone ES module for any project needing an ordered, indexable collection with O(1) insertion/removal.
A configurable HTML-to-tiddlers conversion engine. Given an HTML document and a set of slicing rules (CSS-selector-like patterns with actions like 'tag', 'ignore', 'transclude', 'splice'), the slicer splits the DOM into multiple tiddlers. It supports rule inheritance (parent/child), output modes (flat or nested), and handles complex document structures. The architecture is based on a rule class hierarchy with methods for matching, processing, and generating outputs. This component could be extracted as a general-purpose document segmentation tool for any project that needs to split HTML into structured chunks based on declarative rules.