Closed oeyoews closed 1 year ago
The advantage of not doing this is that the boot process always knows what the filename will be, and the documentation only has to mention one filename. If tiddlywiki.json
were allowed as well as tiddlywiki.info
, the documentation would have to mention both possible filenames, possibly leading to confusion among novice users about which one was the best one to use; the loading code would be (slightly) more complicated, having to decide which file to use if both are present; and so on.
I'm not persuaded that the advantages outweigh the drawbacks here. Perhaps you could explain more about the potential advantages you see in making this change?
possibly leading to confusion among novice users about which one was the best one to use
json5 is the best one to use! Also by using json, we can add json schema link, so we can have intellisense on fields.
json5
is no IANA mime-type. So why should we add something to TW, that cannot be parsed by default JSON.parse()
function?
JSON5 is designed for config files, allowing things like comments and trailing commas (which make adding or removing items from arrays much more convenient). And tiddlywiki.info is indeed a config file. However, @pmario is quite right that default JSON.parse() cannot handle JSON5 format. We'd have to add the json5
NPM package as a tiddler, and it's 31k minified. (9k minified and gzipped, but we don't want to add gzipped tiddlers). Not worth the extra room it would take in TW, IMHO.
That's true. And I think comment on the file is not needed. We can add more document in the jsonschema, use use schema in json, so everyone know what each field means, so no comment is needed.
Thanks @linonetwo @rmunn I think we have consensus that we should not support alternate file extensions for configuration files, and that we should stick with plain JSON for these files. I do see the appeal of JSON5, but I think the extra tooling that it necessitates is prohibitive in cases like ours where JSON processing is really intrinsic to the operation of the app.
While json5 is not an option, I think a .json extension is necessary for modern editors to recognize it. And this can be opt-in, compatible with old .info extension.
Modern editors have an option to configure additional extensions. At least it works nice with VSCode
Is your feature request related to a problem? Please describe. Configuration files support multiple file extensions
Describe the solution you'd like Currently it is tiddlywiki.info. I wonder if we can support json, js and other extensions. I took a rough look at the code of boot.js. I think this should be easier to implement. Do you have any suggestions?
https://github.com/Jermolene/TiddlyWiki5/blob/ceee20fd5970e1b75c2117d2522c998a6c5054f3/boot/boot.js#L2367
https://github.com/Jermolene/TiddlyWiki5/blob/ceee20fd5970e1b75c2117d2522c998a6c5054f3/boot/boot.js#L2205
ps: If the configuration file is invalid, wikiInfo should not be empty,
Should be a good choice
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.