Introduction: For a while now I’m using TiddlyWiki as a private Journal, running on a VPS via Node.js. I cannot think of a better utility to organize my thoughts and am very greatful for all the work and support put into it.
Recently I’ve started to create little website projects (artist and writer portfolios) with Next.js and enjoy the ease of the framework in building pretty and fast-loading designs with little animations, running a lot of optimizations in the background, which I as a relative newbee in webdesign have had no idea of.
Project: Now I am trying to combine those two things and publish some content (articles and reviews) from my TiddlyWiki on a Next.js website, turning my TW into a low profile CMS. I prefer it over a seperate headless CMS, because all the content and text-formatting is already there and I don’t have to build new data structures from scratch. During a week of studying and working on it, I made a good start with exporting/rendering tiddlers to a JSON-file and using it as a data-source for my Next.js-frontend with dynamic routing.
My shortcoming/the “problem”: I guess in the frontend it would be nice to get HTML-formatted text field content. But the JSON-files I exported from TW on the command line with the given example
tiddlywiki --render ‘.’ ‘tiddlers.json’ ‘text/plain’ ‘$:/core/templates/exporters/JsonFile’ ‘exportFilter’ ‘[tag[HelloThere]]’
or alternatively with the export button always delivered results with wikiText syntax wherever it is used inside of the text fields of my tiddlers. Messing with the render-type (setting it to “text/html”) of the command line and in a modified test copy of the jsontiddlers macro was of very limited success. I found TW-links rendered into HTML expressions on occasion, but I could not get the same result for ! headings, <<<blockquotes<<< or //italics// (which are probably the most common uses of wikiText in my tiddlers).
It seems like a very basic operation to me and I probably missed a point somewhere, yet after several days of research I have had no success. So, can you give me a hint on a solution? Is there a simple argument to pass to the renderCommand for the desired result? Or should I change my approach and maybe there is a TW-wikiText-parser in JS available to easily integrate on the frontend? I guess the JSON-format fits best for the integration, because title, tags, text and all the other fields are easy to access seperately (so I can construct previews with less, full articles with more information on the frontend from the same dataset), but maybe HTML, markdown (or even .tid) format is a better way to go?
The solution does not have to cover all the sophisticated uses of wikiText, no widgets, macros or variables are used in the articles, just some basic formatting. Providing external links and transclusions would be nice to have as a bonus.