Code Formatting Organisation Discussion #9172
Replies: 3 comments 3 replies
-
Which "code" you mean. TW WikiText or the core JavaScript code? For the core JS code we plan to implement a pretty-printer, which does the formatting automatically. For the WikiText code the "rules" are more relaxed, since we do have a lot of UI code, that dates back to 2014 or earlier. Where we did not really know, what the requirements would be in 2025. So most of that UI code did grow organically and was written by different contributors. So it is natural, that there are differences. Also in earlier TW versions it was not possible to have newlines within widget parameters, so it was common to have very long lines. Now we can have line breaks, almost everywhere. With the TW core we use
Indentation is done using TABs, because we ship the UI and JS source code as plain text. So it needs less memory. So "new style" wikitext code looks like this. eg: TiddlyWiki5/core/ui/SideBar/Tools.tid Lines 1 to 27 in e8a7bbf |
Beta Was this translation helpful? Give feedback.
-
I fully support this. While wikitext offers flexible formatting, for those merged into the core in TW5.4.0, we should at least have best practice recommendations. |
Beta Was this translation helpful? Give feedback.
-
I did create a new issue: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I often deepen my understanding of TiddlyWiki by studying the core entries, but I find that a lot of the code doesn't have a strict format. It doesn't. Some like single quotes, some like double quotes, some like line breaks, some like spaces, some like tabs. of course there are times when we need to use a mix of single quotes and double quotes, but this should be used in special cases, not universally at random.
I think a code formatting specification should be introduced in version 5.4.0. ME. Or we could develop a specialised plugin to do such a thing, I've been looking forward to such a tool.
Beta Was this translation helpful? Give feedback.
All reactions