Commit graph

958 commits

Author SHA1 Message Date
lin onetwo
20d6be1e23
feat: serialize AST node back to wikitext string (#8258)
* refactor: extract a new $tw.wiki.getParser

* feat: allow $tw.utils.getParseTreeText to render other rules' text

* feat: two example getText handler

* Revert "feat: allow $tw.utils.getParseTreeText to render other rules' text"

This reverts commit 8a12498fa9.

* refactor: keep original getParseTreeText not touched

* refactor: use serialize in rules

* refactor: $tw.utils.extend({},options) -> options || {}

* Update codeinline.js

* Create test-wikitext-serialize.js

* DEBUG: only run my tests for development, remove before PR merge

* lint: if

* feat: add rule: 'parseBlock' metadata

* feat: handle tailing \n that may be missing

* feat: allow recursive

* feat: generate more rule and tests

* feat: generate more rule and tests

* fix: remove pragma:true, otherwise following text will become children of it

* fix: condition manually

Deekseek is silly

* fix: some test

* fix: some test

* feat: $tw.utils.serializeAttribute

* fix: use "" for string param

* feat: list

* refactor: ' -> "

* fix: parsemode don't have node

* fix: render invisible comment and parsemode as data element

* feat: add void: true, in ast node to prevent render

* feat: use void widget, so methods always return a widget

* feat: ast to use new widget type void

* test: add rule: 'parseBlock' and isRuleEnd: true

* lint: quote

* Update widget.js

* fix: void node need to handle its children

* Update test-wikitext-parser.js

* lint: quote

* Update void.js

* Update test-wikitext-parser.js

* fix: macrodef with comment (void node) not working

* lint: ' -> "

* feat: add to styleblock

* feat: styleblock

* feat: styleinline

* Update table.js

* lint: useless comments

* feat: transcludeblock

* refactor: reuse block on inline when possible

* feat: use void node to carry important info for typedblock

* feat: run all tests

* lint: useless ai generated comments

* Update conditional.js to not include space

* Update test-wikitext-serialize.js

* Update conditional.js

* refactor: move tiddlers to /data

* refactor: no need for new $tw.Wiki()

* lint: double quote

* refactor: lowercase the parseblock rule name

* fix: Wiki parser initialize blockRuleClasses only when first new an instance

* feat: restore inline macro def

* fix: macro in widget param

* fix: positional attribute in macro call

* fix: table space and horizrule block new line

* feat: make sure block rule all have \n\n for visiblity

* lint: function param

* fix: empty list item

* feat: add \n\n based on isBlock, if could also be inline

* fix: conditional without elseif

* refactor: use isBlock in macrodef to know inline or block

* fix: link may not have attribute and children

* DEBUG: render result and diff below body only on browser

DEBUG: render result below body only on browser

DEBUG: render result below body

DEBUG: fix build

DEBUG: show render result as ViewTemplate

* fix: remove pad space in />

* test: remove pad space in />

* Revert DEBUG: render result and diff below body only on browser

* refactor: fold commentText variable

* refactor: fold long comment

* fix: double quotes for parameter values

* Update void.js

* refactor: move all exports.serialize = function(tree,serialize) { to plugin

* fix: expost listTypes from core, and require it in plugin

* refactor: move serializeWikitextParseTree to plugin and init it

* refactor: move serializeAttribute util also to the plugin

* fix: Delete unused file

* Update macrodef.js

* Update test-wikitext-parser.js

* lint: fix

* Update plugins/tiddlywiki/wikitext-serialize/rules/filteredtranscludeblock.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update core/modules/widgets/void.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update plugins/tiddlywiki/wikitext-serialize/rules/list.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update plugins/tiddlywiki/wikitext-serialize/rules/list.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update plugins/tiddlywiki/wikitext-serialize/rules/styleblock.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Remove unused methods from VoidNodeWidget

Deleted render, execute, and refresh methods from VoidNodeWidget as they are no longer needed. The widget now only inherits from the base Widget class and exports the constructor.

* docs: about regex in styleinline.js

* Update parsetree.js

* Update core/modules/widgets/void.js

Co-authored-by: Jeremy Ruston <jeremy@jermolene.com>

* feat: Ensure at least one space after the style/class

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Jeremy Ruston <jeremy@jermolene.com>
2025-10-29 21:21:36 +00:00
s793016
cda8d7ca8c
Aho-Corasick Freelinks Enhancement for Large Wikis and Non-Latin Titles (#9084)
* Enhance Freelinks with Aho-Corasick for long titles and large wikis

Replaces regex with Aho-Corasick, adds chunking (100 titles/chunk), cache toggle, and Chinese full-width symbol support. Tested with 11,714 tiddlers.

* delete comment

* Create AhoCorasick.js

* Update text.js

* Update text.js

* Update AhoCorasick.js

* Update text.js

* Update text.js

* move AhoCorasick to AhoCorasick.js

* update AhoCorasick.js

* Delete core/modules/utils/AhoCorasick.js

wrong place

* Update text.js

* indentation modify

* remove function {}

* remove function {}

* Rename AhoCorasick.js to aho-corasick.js

correct filename

* Update tiddlywiki.info add freelink

* missing a comma here

* clean up comments & use old style

* try add it to editions/tw5.com-server for testing

* try add it to editions/prerelease for testing

* optimized

* optimized

* add setting for "Persist AhoCorasick cache"

* add  dynamic limits

* remove comment

* revert to 5f0b98d1fd

* try sort alphabet

* try sort alphabet

* try sort alphabet

* typo freelink -> freelinks

* typo freelink -> freelinks

* typo freelink -> freelinks

* Update readme.tid

* Update aho-corasick.js

Dynamically adjust limit parameters to avoid problems caused by hard-coded limits.

* Update text.js

Dynamically adjust limit parameters to avoid problems caused by hard-coded limits.

* Update tiddlywiki.info

remove other plugin for test plugin conflict

* Update tiddlywiki.info

* Update tiddlywiki.info

* Update aho-corasick.js

Description of major changes

Improve state transition logic - Ensure to go back to root node correctly in case of mismatch, and check root node for current character transition 
Fix failed link traversal - Add condition node ! == this.trie to avoid infinite loop at root node 
Enhance output collection - collect output not only from current node, but also from all nodes on failed link path, which is key to Aho-Corasick algorithm 
Add safety limit - collectCount < 10 to prevent failed link loops

Translated with DeepL.com (free version)

* Update aho-corasick.js

Word Boundary Check - The isWordBoundaryMatch function checks if the match is on a word boundary:

Alphanumeric characters [a-zA-Z0-9_] are regarded as unicode characters 
At least one non-unicode character must be present before and after the match for it to be considered valid.

* Update text.js

Word Boundary Check - The isWordBoundaryMatch function checks if the match is on a word boundary:

Alphanumeric characters [a-zA-Z0-9_] are regarded as unicode characters 
At least one non-unicode character must be present before and after the match for it to be considered valid.

* Update settings.tid

Word Boundary Check - The isWordBoundaryMatch function checks if the match is on a word boundary:

Alphanumeric characters [a-zA-Z0-9_] are regarded as unicode characters 
At least one non-unicode character must be present before and after the match for it to be considered valid.

* fix Word Boundary logic

* remove PersistentCache @ text.js

* remove PersistentCache @settings.tid

* Update readme.tid for Word Boundary Check

* Update aho-corasick.js Organize and delete comments

* Initial commit of freelinks plugin

* Update settings.tid Organize and delete comments

* Update tiddlywiki.info add back other plugin

* Update tiddlywiki.info alphabet sort

* Update readme.tid for new future

The plugin supports non-Western language tiddler titles (e.g., Chinese) and prioritizes longer tiddler titles for matching, ensuring accurate linking in diverse contexts. 

Furthermore, the current tiddler title within its own content is excluded from generating links to avoid self-referencing.

* Update readme.tid

* Update plugins/tiddlywiki/freelinks/text.js

Co-authored-by: Mario Pietsch <pmariojo@gmail.com>

* Update plugins/tiddlywiki/freelinks/aho-corasick.js

Co-authored-by: Mario Pietsch <pmariojo@gmail.com>

* Update plugins/tiddlywiki/freelinks/aho-corasick.js

Co-authored-by: Mario Pietsch <pmariojo@gmail.com>

* Update plugins/tiddlywiki/freelinks/text.js

Co-authored-by: Mario Pietsch <pmariojo@gmail.com>

* Update plugins/tiddlywiki/freelinks/aho-corasick.js

Co-authored-by: Mario Pietsch <pmariojo@gmail.com>

* Update text.js

Added locale configuration support - Added LOCALE_CONFIG_TIDDLER constant to make the sorting locale configurable instead of hardcoded "zh"
Optimized title processing - Combined the filtering and escaping logic into a single pass to reduce duplication
Added trim() for ignoreCase - Applied .trim() to the ignore case variable for consistency
Enhanced refresh logic - Added locale configuration tiddler to the refresh check
Improved comments - Added explanation for why sorting is necessary (prioritizing longer titles)

* Update text.js

we don't need to specify 'zh' at all

* Update aho-corasick.js

This single line change would add support for:

Accented letters: á, é, í, ó, ú, à, è, ì, ò, ù, ä, ë, ï, ö, ü, ñ, ç, etc.
Most Western European languages (Spanish, French, German, Italian, Portuguese, etc.)

* Update aho-corasick.js useage

* Update readme.tid for Writing Style

* Update tiddlywiki.info

revert all the changes

* Update tiddlywiki.info

revert all the changes

* Update tiddlywiki.info

revert all the changes

* Update tiddlywiki.info

revert

* Update text.js

plugins/tiddlywiki/freelinks/text.js#L25
[ESLint PR code] reported by reviewdog 🐶
Strings must use doublequote.

* Update aho-corasick.js

plugins/tiddlywiki/freelinks/aho-corasick.js#L193
[ESLint PR code] reported by reviewdog 🐶
Strings must use doublequote.

Raw Output:
{"ruleId":"@stylistic/quotes","severity":2,"message":"Strings must use doublequote.","line":193,"column":50,"nodeType":"Literal","messageId":"wrongQuotes","endLine":193,"endColumn":52,"fix":{"range":[5743,5745],"text":"\"\""}}

---------

Co-authored-by: Mario Pietsch <pmariojo@gmail.com>
2025-10-29 17:41:35 +00:00
XLBilly
ec81d6663b
[5.4.0] Update highlightjs plugin (#9118)
* Bump highlightjs version to 11.11.1

* highlightblock.js support es6
2025-10-29 11:04:53 +00:00
Leilei332
276fdc8634
Purge deprecated plugins and editions (#9350) 2025-10-21 11:51:12 +01:00
cdruan
91871d2ced
Markdown: Fix missing inline support and macrocall args parsing error (#9295)
* Rewrote tw_macrocallinline() parser so macrocall args containing ">"
will be parsed properly.

* Use $tw.log.MARKDOWN flag to print debug messages.

* Fix markdown parser to respect parseAsInline option. (#8917)
2025-10-10 13:31:11 +01:00
Leilei332
dc7f2a57bb
Use currentColor to style svg (#9316)
* Replace fill: with currentColor

* Remove fill from wikitext

* Replace fill property with color property for svg selectors

* Further remove fill property

* Replace more fill properties

* Replace fill in seamless theme

* Replace fill in plugins
2025-10-07 11:55:26 +01:00
Arlen Beiler
f8170cd50a
[5.4.0] Update eslint target to 2017 and do initial fixes (#9135)
* eslint manual fixes
- update eslint to 2017
- add self to forbidden globals
- fix a few unfixable bugs caught by eslint
- convert newer features in twitter-archivist

* add eslint plugin to forbid features

* import changes from @saqimtiaz

* add package.json changes
2025-10-01 15:08:00 +01:00
Leilei332
af63a3b920
Further improvements for offloading server components (#9288)
* Move edition-info and repository to core-server

* Update readme

* Set platform to server for filesystem plugin

* Move startup/command.js
2025-09-14 11:21:42 +01:00
Jeremy Ruston
7944f42467
[v5.4.0] Offload server components from browser builds of TiddlyWiki (#9183)
* Move Node.js specific files out of the core plugin

* Package server files as new $:/core-server plugin

* Missed commander.js

* Fix crash in browser

* Extend server-only mechanism to be usable by other plugins

* in

* Revert "Extend server-only mechanism to be usable by other plugins"

This reverts commit 3faf503073.

* Revert "in"

This reverts commit b80213128f.

* Reapply "Extend server-only mechanism to be usable by other plugins"

This reverts commit c6c83bc18b.

* Fix test failure

* Move filesystem utilities into core-server

* Move old-style release notes out of the way

* Move the 5.4.0 release note into the right place

* Revert "Move the 5.4.0 release note into the right place"

This reverts commit 3f5c2bfba3.

* Revert "Move old-style release notes out of the way"

This reverts commit ee16e48a43.
2025-09-12 15:21:34 +01:00
Jeremy Ruston
82dbc4b14c
Import community survey 2025 (#9189)
* Community Survey import specifier for xlsx plugin

* Community Survey 2025 improvements

* Survey results as of 25th July 2025

* New 2025 answer

* Save changes on the server for when we're importing on the command line

* Improve import specs

* Reimport answers with new schema

* Fix schema

* Fix responses

* Show response count

* Add count for each unique response

* Update responses
2025-07-28 10:59:10 +01:00
Leilei332
a785d1f4d2
Fixes for highlight plugin theme list (#9185) 2025-07-25 15:18:36 +01:00
Leilei332
cd480de280
Bump codemirror 5 plugin version to 5.65.19 (#9114)
* Bump codemirror 5 plugin version to 5.65.19

* Update autocomplete

* Update closebrackets

* Update fullscreen

* Update keymap

* Update modes

* Update search

* Update trailingspace

* Fix broken markdown mode

* Add all codemirror plugins to codemirrordemo edition
2025-06-28 16:18:42 +01:00
Leilei332
7a1b39accb
Correct the way of adding themes in highlightjs plugin (#9105) 2025-06-19 11:26:56 +01:00
Jeremy Ruston
da4f5c64ca Change experimental plugins to stable
See discussion at https://talk.tiddlywiki.org/t/introduction-to-the-geospatial-plugin/7984/37
2025-05-18 12:04:08 +01:00
Jeremy Ruston
c409d8414e Fix bug exposed by #9030
I think the bug was originally introduced in a9f9ffd409
2025-04-14 22:17:18 +01:00
Mario Pietsch
4e28742aa6
Remove function wrappers from plugins (#9030) 2025-04-14 18:28:04 +01:00
Leilei332
34cf59d31e
Fix some download file types. (#9026) 2025-04-12 15:32:10 +01:00
Mario Pietsch
8aa558eb2c
Remove module function wrapper and add matching configurations for dprint and eslint (#7596)
* remove blks first try

* dprint.json seems to be OK, some forgotten functions

* add some more space-after-keyword settings

* server remove blks

* add **/files to dprint exclude

* dprint.js fixes a typo

* add boot.js and bootprefix.js to dprint exclude

* dprint change dprint.json

* add dprint fmt as script

* remove jslint comments

* fix whitespace

* fix whitespace

* remove function-wrapper from geospatial plugin

* fix whitespace

* add function wrapper to dyannotate-startup

* remove dpring.json
2025-03-21 17:22:57 +00:00
Leilei332
0b3efc2771
Fix overflow in Browser Storage settings page (#8752)
Only a small fix
2025-03-21 13:35:26 +00:00
Jeremy Ruston
d3f441cbb5 Unpack plugins for wiki based tests 2025-02-18 21:15:01 +00:00
Jeremy Ruston
2ebf452abb Consent banner should not display in static renderings 2025-02-09 14:29:43 +00:00
Galen Huntington
b04af8bf7a
Bug fix: TTF extension was wrong. update font types, add OTF type. (#8898)
* Bug fix: TTF extension was wrong.

* Update font MIME types throughout; add font/otf.
2025-01-23 18:18:02 +00:00
Michael McDermott
81a972dc46
Create setting for default type of draft tiddlers (#8783)
* Proof of concept to change type of tiddlers created by editing missing.

* Adding a setting for default type so that it can be overridden for other wikis.

* Incorporating PR feedback.

* Adding documentation tiddler for new setting.

* Added documentation to the markdown plugin documentation.

* Added documentation to the markdown plugin documentation.

* Added notice to markdown edition.
2024-11-27 16:26:53 +00:00
Jeremy Ruston
3fb2f980c8
Geospatial Plugin: Improve Event Support (#8740)
* Add onclick attribute to geolayer widget

* Temporarily add the plugin to tw5.com for the Netlify preview

* Rename onclick to clickActions

And add docs for the lat, long, alt variables

* No longer apply the default popup template

Now that we have customisable popups the default one is pretty useless

* Prepare for merging to v5.3.6

The special circumstances are that this PR is confined to a plugin, and that the new work is an extension of the new features already merged in v5.3.6
2024-11-15 12:03:16 +00:00
Leilei332
40fca47974
Translator editon update (#8703)
* Translator editon update

Update for the translator editon, including:

* Changes to `--render` in `tiddlywiki.info`, and changes the command
  for generating `$:/languages/Docs/Types/` to replace strings with `_`
instead of using uri encoding.
* Update docs. The guide for changing `$:/core/readme` tiddler is wrong,
  so I removed it.

* Simplify templates and commands

* Add progress bar
2024-10-29 12:07:12 +00:00
Jeremy Ruston
060cfd4868 Fix geomap with markers docs demo 2024-10-17 11:14:09 +01:00
Mateusz Wilczek
ddb6c206cb
Update docs for makeqr macro (#8654) 2024-10-09 12:11:44 +01:00
Leilei332
c82761a600
Add tc-table-wrapper class to fix overflow (#8652)
* Add tc-table-wrapper class to fix overflow

* Apply class in tag manager body
2024-10-02 13:06:40 +01:00
Leilei332
2dd8ff95b2
Fix github fork ribbon plugin marked as deprecated & add it back to full edition. (#8656) 2024-10-02 12:42:49 +01:00
Mario Pietsch
fca39c7f72
Remove function wrapper (#8625)
* remove function wrapper

* add back anonymous function to sjcl.tid
2024-10-01 13:16:39 +01:00
btheado
7bf2fee15e
Fix geospatial plugin map state loading (#8511) 2024-09-30 14:49:33 +01:00
Leilei332
36b988c273
Gather all the plugins' settings page under the control panel's "Settings" tab. (#8643) 2024-09-30 14:23:29 +01:00
Leilei332
e93515f32a
Fix style of codemirror settings page (#8600)
A small fix to make its style the same as the TiddlyWiki settings page.
2024-09-15 11:49:33 +02:00
Leilei332
3355907581
Seperate clear cookie and disable actions in Browser Storage Plugin (#8602)
Added two messages:
* `tm-delete-browser-storage` for deleting the cookie saved by the
  Browser Storage plugin
* `tm-disable-browser-storage` for disabling Browser Storage
2024-09-15 11:48:08 +02:00
Leilei332
18e1ee44d8
Move contents of config tab to readme tab in markdown plugin (#8595) 2024-09-12 19:31:13 +01:00
Michael McDermott
bae2b78925
Added keyboard shortcut option for menubar search. (#8350) 2024-09-11 17:13:54 +01:00
Leilei332
eaf8558595
Update PageControls buttons to use v5.3.2 syntax (#8579)
* Let PageControls buttons use v5.3.2 syntax

* Rewrite buttons and actions

* Omit whitespace & use function to avoid duplicating

* Omit whitespace in conditional syntax
* Define tf.get-tags function to avoid duplicated text substitution
* Rewrite advanced search button

* Add space in join operator

* Rewrite buttons in plugins

* Remove tf prefix in new-journal.tid

* Remove tf prefix in new-tiddler.tid
2024-09-10 12:00:13 +01:00
Leilei332
3434884ea4
Add a settings page for markdown plugin (#8585)
* Add a settings page for markdown plugin

* Add link to $:/config/markdown/renderWikiText

* Place "Quotes replacement" settings after "Typographer"

* Add link to plugin itself & remove transclusion in config tab

The transclusion to $:/plugins/tiddlywiki/markdown/settings in config
tab is removed to avoid confusion

* Add settings tab in plugin info
2024-09-10 11:13:00 +01:00
Mario Pietsch
e1b3308a9d
Fix float right overflow (#8557)
* tc-subtitle is not a sibling to tc-body,
So tc-subtitle needs a clearfix to contains float:right

* add clearfix to all tiddler elements that could contain floats

* add clearfix to tc-tiddler-title in ViewTemplate

* add clearfix to plugin/blog/templates

* add clearfix to plugin/tour/templates

* remove test tiddler

* rename draft title class to tc-tiddler-title-draft

* undo title field covering

* move tc-clearfix to tc-float-right in the base CSS file

* rename clearfix CSS class to tc-clearfix

* update documentation tiddlers
2024-09-09 09:48:57 +01:00
Leilei332
9a3f1d25e5
Update toolbar buttons to use v5.3.2 syntax (#8584) 2024-09-05 18:40:18 +01:00
Jeremy Ruston
69637640d2
Standardise whitespace in conditional shortcut syntax (#8583) 2024-09-02 16:51:15 +01:00
btheado
9a4aafdb41
Prevent geospatial plugin exception when geomap contains empty geolayer widget (#8484)
* Prevent exception when geomap contains empty geolayer widget

* Convert testcase widget into testcase tiddler
2024-08-30 14:21:46 +01:00
Jeremy Ruston
38081b86c9 Filesystem adaptor should not crash with missing wiki folder 2024-08-21 18:56:34 +01:00
Leilei332
c225013d1a
Add type attribute to input fields in control panel (#8518) 2024-08-21 11:16:13 +01:00
Mario Pietsch
231a39e743
Fix whitespace in all plugins for v5.3.6 (#8285)
* Fix whitespace in all plugins for v5.3.5

* remove const to var chanes
2024-08-20 16:33:07 +01:00
Leilei332
0bfa12466e
Apply proper color for target footnote background in markdown (#8492)
* Use footnote-target-background index for the color of the background of target footnote

* Apply proper color to palettes
2024-08-07 12:07:22 +01:00
Jeremy Ruston
9b6baba5d5 Fix geospatial plugin popup demo 2024-08-06 21:32:04 +01:00
Leilei332
885faf964b
Fix strange links in $:/plugins/tiddlywiki/highlight/usage (#8487)
* Normalize links in highlight usage

* Revert to use define
2024-08-05 15:29:16 +01:00
Leilei332
22286aa569
Add image toolbar dropdown to markdown plugin (#8459)
* Add image toolbar dropdown to markdown plugin

* Escape special characters
2024-07-31 13:38:25 +01:00
Mario Pietsch
8735d1ac93
Add vnd.tiddlywiki-multiple to the editor type dropdown (#8450)
* add text/vnd.tiddlywiki-multiple to editor type dropdown

* de-DE add text/vnd.tiddlywiki-multiple to editor type dropdown

* move text/x-tiddlywiki to classictools plugin

* remove image/x-icon from all languages files

* move type text/vnd.tiddlywiki-multiple to Developer
2024-07-29 22:04:06 +01:00