Seeking Tool to Toggle Between Rendered View and Raw TW Markup in Storyriver

I’m looking for a toggle button that re-renders tiddlers in the storyriver to either display just their raw TW markup code or the usual rendering of the body. For individual tiddlers, I’ve used something similar in the past:

{{@@white-space:pre;
{{Foobar Title}}
@@

I’m looking for a tool that does it en masse so that one can quickly select and copy the desired data directly from the TiddlyWiki interface for use with LLMs.

For context, I’ve been very regularly using my storyriver as a workspace to create the contextstuffings for LLM promptcraft. I’m the sort who often pulls up +100 various tiddlers at a time (often the quickest way to select these is from navigating TW itself). I want it to be relatively easy to copy’n’paste the markup versions of these ad hoc storyrivers. One can already do this with rendered tiddlers, but the raw markup tends to be significantly more valuable for use with current LLMs. Markup syntax often provide enormous (if not outright necessary) semantic content, disambiguation, and intent. Even for those of us who are pretty minimalist in our use of markup, there can be significant differences in the LLM’s interpretation of the data properly with or without it.

I can’t seem to find anyone who has done this. Has anyone got this tool or something like it?

I have a button that you click to copy the contents raw, or previews that can be set on any tiddlers, and you can change the type to see as plain text.

  • I think there are a lot of ways to do this.
1 Like

As far as I know, there is no such thing that you describe.

I think you describe 3 different functions in your request.

  1. The first one is to show single tiddlers in text/plain mode
  2. Show all tiddlers in the story river in text/plain mode
  3. Copy the content of all the tiddlers in the story river in text/plan format to the clipboard, so it can be pasted into LLMs input box.

I think 1. and 2. can be done creating a ViewTemplate that is linked into the ViewTemplate-cascade that can show text/plain using one or more $:/state/ tiddlers.

The 3rd one is a completely different thing. I think there should be a possibility to copy the tiddler content in .tid file format into the clipboard. So it does not only copy the “structure” of the text-field, but also shows the LLM all other fields, that may be part of the tiddler. eg: tags

It should probably be possible to “exclude” some fields, that may have potential to “confuse” LLMs

just brainstorming
-mario

1 Like

!! @TW_Tones

Thank you, sir.

I have a button that you click to copy the contents raw, or previews that can be set on any tiddlers, and you can change the type to see as plain text.

I can imagine that comes in handy, /nod. The issue is that I’m in need a single button to do it all.

I think there are a lot of ways to do this.

Agreed. I’ll provide the way I ended up handling it, but I’m not convinced it is the best option for most people, especially since I use a much older version of TW.


!! @pmario

Show all tiddlers in the story river in text/plain mode

You’re correct: this is the fundamental function.

I think 1. and 2. can be done creating a ViewTemplate that is linked into the ViewTemplate-cascade that can show text/plain using one or more $:/state/ tiddlers.

IIUC (and I easily may not), I’ve not upgraded to the point where I have cascades, I believe. That may come later. That seems like a more appropriate approach.

The 3rd one is a completely different thing. I think there should be a possibility to copy the tiddler content in .tid file format into the clipboard. So it does not only copy the “structure” of the text-field, but also shows the LLM all other fields, that may be part of the tiddler. eg: tags.

I barely use standard fields at all, and I’m okay with some imperfection in how the tags are captured. You’re correct that a more perfect answer in general would allow one to clearly distinguish (and specifically eliminate some of) the fields for LLMs in a way that looks more like the .tid files. My approach here is ugly by comparison. As odd as it sounds, if I were to munge or reformat the data further at this point, I’d use system tooling.

I just hit the toggle, Ctl+A then Ctl+C, untoggle, and paste it straight into the LLM input stream. It’s good enough for my case.

just brainstorming

I’m honored and [[grateful]]. Thank you, sir.


!! @All

My favorite hacker came to my rescue. Thank you, [[j3d1h]]. In case this may be useful to anyone else, and to save you from searching my ℍ𝕪𝕡𝕖𝕣𝔱𝔢𝔵𝔱 in this case, I’ll show you what we’ve got. We’ve modified [[$:/core/ui/TopBar/menu]] to add a button. We decided to leave system tiddlers in the storyriver untouched. I’m not sure if there are any gotchas (we’ve not found any so far).

[[Plaintext Body Rendering Toggle]]:

<$reveal type="match" state="$:/state/ugly" text="">
<$button class=<<tv-config-toolbar-class>> set="$:/state/ugly" setTo="false">△</$button></$reveal>

<$reveal type="match" state="$:/state/ugly" text="true">
<$button class=<<tv-config-toolbar-class>> set="$:/state/ugly" setTo="false">
<$action-deletetiddler $tiddler="$:/core/ui/ViewTemplate/body"/>
◭</$button></$reveal>

<$reveal type="match" state="$:/state/ugly" text="false">
<$button class=<<tv-config-toolbar-class>> set="$:/state/ugly" setTo="true">
<$action-setfield $tiddler="$:/core/ui/ViewTemplate/body" text='<$reveal tag="div" class="tc-tiddler-body" type="nomatch" state=<<folded-state>> text="hide" retain="yes" animate="yes">

<$list filter="[all[current]!has[plugin-type]!field:hide-body[yes]!is[system]]">

<div style="white-space: pre-wrap;"><$text text={{{ [all[current]get[text]] }}}>
<$transclude tiddler="$:/language/MissingTiddler/Hint"/>
</$text></div>

</$list>

<$list filter="[all[current]!has[plugin-type]!field:hide-body[yes]is[system]]">

<$transclude>

<$transclude tiddler="$:/language/MissingTiddler/Hint"/>

<$list filter="[title{!!title}listed[aliases]first[]]" variable="">
You may have meant one of the following pages
<$list filter="[title{!!title}listed[aliases]]">
<li><$link>{{!!title}}</$link></li>
</$list>

</$list>
</$transclude>

</$list>

</$reveal>' />
◮</$button></$reveal>