A major mode for Emacs to edit TiddlyWiki .tid files.
-
Syntax highlighting for TiddlyWiki wikitext markup:
- Headings (
!,!!,!!!, etc.) - Text formatting: bold (
''text''), italic (//text//), underline (__text__), strikethrough (~~text~~), superscript (^^text^^), subscript (,,text,,) - Inline code (
`code`) and code blocks (```) - Links (
[[link]],[[display|link]]) - Transclusions (
{{tiddler}}) - Macros (
<<macro>>) - Widgets (
<$widget>) - Lists (
*,#,-) - Definition lists (
;,:)
- Headings (
-
Header management:
- Parse and modify
.tidfile headers - Automatic
modifiedtimestamp update on save - Toggle header visibility (narrowing)
- Parse and modify
-
Multi-wiki support:
- Configure multiple wikis
- Switch between wikis easily
-
Navigation:
- Open tiddlers with completion
- Search in tiddlers with
consult-ripgrep - Create new tiddlers
(use-package tiddlywiki-mode
:straight (:host github :repo "dionisos2/tiddlywiki-mode")
:mode "\\.tid\\'"
:bind (:map tiddlywiki-mode-map
("C-p C-p C-o" . tiddlywiki-open-tiddler)
("C-p C-p C-s" . tiddlywiki-grep)
("C-p C-p C-n" . tiddlywiki-new-tiddler)
("C-p C-p C-w" . tiddlywiki-select-wiki)
("C-p C-p C-h" . tiddlywiki-toggle-header)
("C-p C-p C-t" . tiddlywiki-add-tag)
("C-p C-p C-r" . tiddlywiki-remove-tag))
:custom
(tiddlywiki-wiki-alist
'(("my-wiki" . "~/path/to/wiki/tiddlers")
("other-wiki" . "~/path/to/other/tiddlers")))
(tiddlywiki-default-wiki "my-wiki"))
(use-package poly-tiddlywiki
:demand
:straight nil
:mode ("\\.tid\\'" . poly-tiddlywiki-mode))Clone this repository and add to your load path:
(add-to-list 'load-path "/path/to/tiddlywiki-mode")
(require 'tiddlywiki-mode)Configure your wikis in tiddlywiki-wiki-alist:
(setq tiddlywiki-wiki-alist
'(("personal" . "~/wikis/personal/tiddlers")
("work" . "~/wikis/work/tiddlers")
("notes" . "~/wikis/notes/tiddlers")))Set a default wiki:
(setq tiddlywiki-default-wiki "personal")(setq tiddlywiki-update-modified-on-save nil)The mode does not define default keybindings. Here are the suggested bindings (included in the use-package example above):
| Key | Command | Description |
|---|---|---|
C-p C-p C-o |
tiddlywiki-open-tiddler |
Open a tiddler with completion |
C-p C-p C-s |
tiddlywiki-grep |
Search in tiddlers (requires consult) |
C-p C-p C-n |
tiddlywiki-new-tiddler |
Create a new tiddler |
C-p C-p C-w |
tiddlywiki-select-wiki |
Select active wiki |
C-p C-p C-h |
tiddlywiki-toggle-header |
Toggle header visibility |
C-p C-p C-t |
tiddlywiki-add-tag |
Add a tag to current tiddler |
C-p C-p C-r |
tiddlywiki-remove-tag |
Remove a tag from current tiddler |
Use C-u prefix with navigation commands to select a different wiki.
For proper syntax highlighting and indentation inside code blocks, you can use the polymode integration:
(use-package poly-tiddlywiki
:demand
:straight nil
:mode ("\\.tid\\'" . poly-tiddlywiki-mode))This enables:
- Syntax highlighting using the language's major mode
- Proper indentation inside code blocks
- All editing features of the associated mode
Note: Code blocks must specify a language (e.g., ```python) to activate the inner mode. Blocks without a language specifier will use the host mode's highlighting.
By default, heavy mode hooks (LSP, eglot, flycheck, etc.) are filtered out to avoid starting heavy processes for each code block. Lightweight hooks (show-paren-mode, electric-pair-mode, etc.) run normally.
The default blacklist includes:
lsp,lsp-deferred,lsp-modeeglot-ensureflycheck-mode,flymake-modecompany-mode,corfu-modetree-sitter-mode,copilot-mode- And others
You can customize the blacklist:
(setq tiddlywiki-code-block-hooks-blacklist
'(lsp lsp-deferred eglot-ensure my-heavy-hook))To run ALL hooks (including LSP), disable hook filtering entirely:
(setq tiddlywiki-code-block-run-hooks t)Languages are automatically mapped to modes (e.g., python → python-mode). You can customize this:
(add-to-list 'tiddlywiki-language-mode-alist '("my-lang" . my-lang-mode))- Emacs 27.1 or later
- consult (optional, for
tiddlywiki-grep) - polymode (optional, for code block support)
make testOr with Eldev:
eldev testmake compileGPL-3.0-or-later
Contributions are welcome! Please open an issue or pull request.