Streaming Tinderbox Note to Marked2?

I’ve got a Tinderbox file with markdown notes that use the Markdown Prototype, and I’m trying to use Marked2 to preview them and optionally convert to a .docx file.

I’m following this page in aTbRef.

I Have a clean, registered copy and install of Marked 2.

But–when I Preview my markdown note in Tinderbox , with the Marked2 app Streaming Preview open, nothing happens.

Any guidance?

I suspect you’ve not got Marked 2’s Streaming Preview window open (as my article does suggest). To do that open that app’s Preview menu → Streaming Preview. Now make or select a note with the Tinderbox ‘Markdown’ prototype applied. now, Edit the text of the Tinderbox note and the Marked 2 streaming preview window updates—or it does for me.

Editing the Tinderbox note doesn’t open the streaming window in Marked 2 if it isn’t open. So you need to set up Marked 2 properly before you will see the preview.

To add to the last, here is what a typical window set up for Streaming Preview looks like. The window on the right is Marked 2. The window on the left is Tinderbox 9.6 with a note that has the Markdown prototype assigned.

OK—thanks for the quick replies!

I found my mistake … the Tinderbox Note that I was trying to stream in Marked2 had Prototype=none, and I was using a Stamp to run this action code:

$HTMLPreviewCommand="CommonMark"; 
$HTMLMarkupText=false;
$HTMLExportTemplate="/Templates/HTML page";

… thinking that would suffice to trigger the streaming in Marked2. It did not.

But, when I apply the default-supplied Markdown prototype to the same Note, streaming in Marked2 begins to work.

Still learning …

I’m curious. There is really nothing special with the Markdown prototype other than it pre-sets certain attribute values. Does anyone have any idea which of the attributes and related settings would have gotten this to start working for Paul?

My reading of the above is that where the RNs—from which I drew my article—referred to a “Markdown note”, they mean explicit use of the Markdown template. Reviewing the RNs, I find this:

To use Markdown for a note, use the built-in prototype Markdown.

Taken in context with @ptc97504’s report above, it would appear that it is a note’s $Prototype value being Markdown that triggers communication with Marked 2. That inter-app communication is configured inside both apps so not user-customisable.

In the case given, no other prototype was needed so there is no reason not to use the Tinderbox build-in ‘Markdown’ prototype. If anyone has use case where that isn’t possible, I would suggest they contact tinderbox@eastgate.com directly, explaining the issue.

Meanwhile, I have done further testing to prove the necessity of explicitly using the Markdown prototype to trigger preview. As a result I have just updated these aTbRef notes to clarify that aspect of use:

It’s actually not necessary to use the built-in Markdown prototype for Streaming Preview to work.

E.g., I have my personal MultiMarkdown prototype that uses

$HTMLPreviewCommand == ‘/usr/local/Cellar/multimarkdown/6.7.0/bin/multimarkdown’ (I installed MultiMarkdown’s processor on my computer.)

Streaming Preview also works with this.

Of course, this doesn’t answer “why” it works.

Oh, that’s interesting. As part of my test above I tried just setting a $HTMLPreviewCommand value but no prototype and got no pickup on the Marked2 side. One for @eastgate to enlighten us about, i guess.

Note: obviously I’ll update my notes if further clarification occurs. But, for the general/new user, explicitly setting the Markdown built-in prototype does seem to ensure preview streaming occurs, even if the real trigger is more subtle. Clearly we need to document the latter so that your usage doesn’t seem to break with described practice. :slight_smile:

1 Like

Dear Dr.Mark Anderson & Mr.PaulWalters,
Thank you for letting me know the precautions and how to use the new Preview.
I already have brew install in my BigSur environment
“/usr/local/Cellar/multimarkdown/6.7.0/bin/multimarkdown”
It was ready, so I tried it immediately.
Streaming Preview in Marked 2 (ver.2.6.25) is also easy to understand.
I am happy that multimarkdown preview can be used like this.
(I was able to confirm the multimarkdown preview feature.)
The sample I tried was
[[Preview big file markdown]]
I used the Big file Markdown.tbx that Mr.Максим Смирнов had posted to.
Yours, WAKAMATSU

1 Like

WAKAMATSU-san, thank you for reminding me that the current version of MultiMarkdown is 6.7.0. I installed that version via Homebrew, and updated my prototype.

1 Like

Side conversation suggests Markdown prototype appears the trigger but only because of its non-default value for $HTMLMarkdown.

So, I’ll need to re-edit those atbRef articles (again!). But, until I do … for most people using the Markdown prototype is a good start. For those who want to pop the hood or have finer control, it appears (from further testing) that $HTMLMarkdown is the setting that enables stream preview generation. with hindsight, this makes sense as $HTMLPreviewCommand simply tells Tinderbox that when doing Markdown render, which flavour of Markdown to use (be it built-in or via a user set local path, e.g. to MultiMarkdown, Github Markdown, etc.)

Interesting. If you set $HTMLMarkdown==true in any note, regardless of prototype, then Marked2 Streaming Preview works.

BTW, there is an $HTMLMarkdown attribute in the HTML group of system prototypes, and a separate $HTMLMarkDown (different use of caps) in the Map group of system prototypes. I see no use for the latter, and it does not affect the Streaming Preview.

1 Like

This was an early naming choice that got abandoned, it became $HTMLMarkdown. You’ll only find the the older form in old docs created in v8 or earlier. $HTMLMarkdown got added in v9. and docs created in that or later won’t have the earlier version. If both are present, the latter is used by Markdown processes and I guess the other is ignored. Similarly $WordCount started out as $Wordcount in very early TBXs and the newer form took over in v3.0.5. There are 5 or six such moribund attributes in long-lived TBXs.

For those comfortable with editing XML and owning long-lived TBXs, you can open (a copyof!) the TBX in BBEdit or similar and edit the XML. Look for and delete these two lines:

<attrib Name="HTMLMarkDown" parent="Map" editable="1" visibleInEditor="1" lines="1" type="4" default="false" >
</attrib>

Then check all is OK before deleting/archiving the original. for most folks who don’t want ot try that, just ignore the old attributes. They do no harm.

Hmm. Perhaps aTbRef could add a list of such attribute. Oh wait … see here for a list of c.40 attributes with no current purpose. They are largely there for legacy compatibility and don’t worry about them.

†. I literally just added $EvernoteNotebook to the list, as Evernote sync was dropped in v9.0.0 nd I omitted to annotate this attribute which only had a role in that sync process.

Just been investigating this further with @satikusala and it brought home a distinction I’d missed.

Important: Markdown stream preview is not the same process as Tinderbox internal preview using Markdown.

Both involve Markdown, but in different ways. Markdown ‘stream preview’ which is sent to apps outside Tinderbox, works when the selected note is in normal (text tab) use. Depending on settings the external stream preview in apps like Marked2 might differ from the render seem in the note’s ‘preview’ tab depending on additional settings you have made.

What? Why? Markdown stream preview pre-dates current more integrated support for Markdown. Stream preview handling was added in v9.0.0 and is only known to work with the Marked 2 app. Tinderbox v9.5.0 added the current Markdown-based zero-configuration preview in the Tinderbox app. Although a different process, the latter effectively replaces the earlier need for streamed previewing although it still works (more good—if confusing—legacy function support).

TL;DR: if you don’t have Marked2 and/or don’t need stream preview you can forget about this feature altogether.

Further to the conversation with @mwra, I found that using markdown images, eg., ![Anchor/Alt](path “title”], works with marketed. Marked will preview the image as well, pretty cool. The “title” in the syntax is options. It is used to title the link as well as to populate help tip popups.

$HTMLMarkDown (different use of caps) in the Map group

This old spelling is marked as “renamed and deprecated”

Markdown stream preview is not the same process as Tinderbox internal preview using Markdown .

Tinderbox’s internal preview sends the Markdown text to a script that converts it to HTML (typically CommonMark), and then displays the result in a web view.

The Marked2 stream receives the Markdown text as contained in the note, and renders it using Marked2’s Markdown processor.

2 Likes

Exactly. Streaming Preview with Marked 2 is independent of previews in Tinderbox, or Curio, or Ulysses, or any of the other apps that work with Marked 2 Streaming Preview. Always has been.

The advantage of using Streaming Preview with Tinderbox is very large. In the example in the image, we see how multiple notes in Tinderbox can be selected and viewed in the aggregate in Marked 2 Streaming Preview. From that view pane, we can, with one click, export the aggregated preview to multiple document types (HTML, PDF, RTFD, RTF, DOCX), and we can apply style sheets to the previewed text before export. This, for me, is a case I use frequently when I want to get notes from Tinderbox into an external document without futzing with Tinderbox export.

Streaming Preview is far from a cute parlor trick.

7 Likes

Interesting, especially the onward export aspect.

Thank you @PaulWalters and @mwra as this has been an extremely helpful thread to have stumbled upon.

2 Likes

Super Useful, thanks Paul! Nice way to export to PDF and other formats for those (like me) naive to Pandoc. Made my day.

Question for anyone that knows Applescript:
I am wanting to trigger this with Keyboard Maestro which uses Applescript, which I do not know.
Anyone have an applescript that can simply automate
$HTMLMarkdown=true

Thanks
Tom