Tinderbox Forum

How to do inline MultiMarkDown footnotes?

I’d like advice on how to proceed, as I’m half way through a problem.

The Goal: Write a book in Tinderbox, with footnotes that are written using the MultiMarkDown (MMD) format. My goal is to be able to move things to Word at the last step, as I prepare for submission to a publisher. I’m an academic. Word files are where it is at.

The Example: Simply put, I want to do is write a MMD footnote in my Tinderbox note.

**The format**: This is some text that I would like to be able to write in MultiMarkDown[^footnote1]

[^footnote1]: MultiMarkDown is a format from Flecher Penny. 

When I do this in a text file directly, things render perfectly in Marked 2.

Yet, doing this in a Tinderbox note, rendering in Marked 2, it never seems to work as I expect. Instead, it produces the following.

After many years of being stuck at this point, this morning, I realized that what seems to be going on is that there is a collision between the ^export^ syntax of TinderBox and the caret symbol of the MultiMarkDown footnote.

My first thought was backslash the caret. \^ But that didn’t work. So, my first question. Is there a way to force the caret not to be interpreted as a caret by Tinderbox?

Fiddling around, I found a work around, and created a Tinderbox macro, that simply adds a [^

This means that the following text

** The format ** : This is some text that I would like to be able to write in MultiMarkDown  ^do("fn")^footnote1]

^do("fn")^footnote1]: MultiMarkDown is a format from Flecher Penny.

renders perfectly, in Marked 2’s stream preview and even directly in Tinderbox!

As an aside, to get it to work directly in TinderBox, I installed MultiMarkDown from Flecher Penny’s site, then changed the HTML Preview Command to “/usr/local/bin/mmd” for the note. It’s is MMD bliss! So, far. I’m flying.

My question are threefold:

  1. First, as a straightforward goal. Is there a way to write [^fn_1] and have it render in MMD correctly? Or, are Macros the way to go? Can I backslash a caret? Or, in some other way, make this happen?

  2. Second, the macro I came up with feels like a hack, and is hard to read as a human in my text. Is there a better way to use such a macro? However, when I try to use a macro like:

    [^$1: $2]

Tinderbox adds space after the caret, and I can’t get it to render properly in MMMD becuase the macro seems to produce:

[^ footnote1]: MultiMarkDown is a format from Flecher Penny.
  1. Third, and my main question, is there a way I should approach doing this more dynamically and automatically? What I’d like is to a creates links of type note in the text, and then have Tinderbox look up the note, intert its $Text directly into the note ready for reading by MMD.

In other words, do some HTML Export Template magic, so that this

Becomes

**The format**: This is some text that I would like to be able to write in MultiMarkDown[^footnote1]

[^footnote1]: MultiMarkDown is a format from Flecher Penny. 

Which can then get passed to MMD, and be rendered in a Preview pane and in Marked 2,* and crucially so that I can export to word at a later date.*

I am insistent on using MMD for footnotes, because it is trivial to use pandoc to convert a mmd file into a LibreOffice file which is then trivial to important into Word, all while keeping the footnotes!

Why do I care?: I wrote my first book in Tinderbox. But, when I moved from Tinderbox to Scrivener or to Word, I had to recreate footnotes by hand. I’d like a better way of doing them, as I start a new book, that will become 200 pages. The publisher wants a simple word file, no formatting, but with footnotes.

What I’d like to be able to write, create footnotes in tinderbox on the fly, then have a pathway to get everything into Word. MMD seems the best way to go. But, maybe it’s a red herring?

Ideas on how best to work with footnotes. Crucially, I think, is there a way to change the anchor text of a link programmatically as the text is exported? If so, as a note is exported, the link anchor text could be converted into a MMD footnote? But, I’m stuck on how to even approach that.

Basically, I’m looking for ideas on which direction to proceed.

Best

Daniel

1 Like

Thanks for this. Tinderbox ships with 2 Markdown flavours:

  • Markdown
  • CommonMark

See here. Markdown has many ‘flavours’ with different supported feature sets. If you want to use an non-bundled Markdown flavour, see the HTMLPreviewCommand attribute you can simply supply the path to where you have installed the ‘MultiMarkDown’ Markdown flavour script.

Until reading your post, I’d assume Mark2 preview would use the Markdown flavour configured in Tinderbox, but clearly not. I’ve no idea if this is possible (paging @eatgate). It guess this boils down to how the two apps interact and whether it is even possible for Tinderbox to signal the intended Markdown flavour.

The bummer for Markdown users is Markdown isn’t one standard flavour as far as I’m aware. Plus for any keen Markdown user, the favour they use is the standard (for their use). I feel your pain her. To generalise the problem, a British person inviting to summer party in shorts (BrE = short trousers, AmE = underwear) might be surprised at the attire of some guests!

TL;DR, try setting MultiMarkDown as your HTMLPreviewCommand and see if it helps. Otherwise we need to dig deeper.

It looks like Marked2 only supports 2 Markdown flavours, nethoer of which Tinderbox uses. Of dear:

This means Marked2 will correctly preview Tinderbox-derived Markdown mark-up as long as the feature(s) used are present in the Tinderbox and Marked2 render flavours.

Do let us know how you get on, as there are plenty here who use, or are thinking of using Markdown in the expert workflow. I hear you on having to use Word; you have my sympathy!

Footnote ( :slight_smile: ) - Support for HTML tables are another-flavour dependent aspect of Markdown use.

Hi Mark,

I’ll try shorter :slight_smile: How are ^ caret characters treated in a note’s text. As I troubleshoot, I wonder if TB be eating the ^'s, thinking they’re export codes.

When I set MMD as my HTMLPreviewCommand, the caret which is part of the Markdown footnote seems to disappear as the note is processed, rendering the footnote broken.

Could

 [^fn]:

in a note’s Text be confusing Tinderbox, which uses the caret for ^action^ codes?

Is there a way to backslash a ^ character with in a note’s text, or to turn off the evaluation of export codes in a note?

I found a workaround with setting the HTML Preview Command to pandoc, yet another flavour of Markdown.

pandoc /usr/local/bin/pandoc -f markdown -t html

And use pandoc’s footnote style, which is ^[Footnote text.]

MMD uses:

[^fn]

[^fn]: Footnote

As I troubleshoot, I wonder. Is TB be eating the ^ caret in this:

[^Footnote]

but not in this

^[Footnote text]

In short, how are ^ caret characters treated in a note’s text?

Once I sort out this, I come to my substantive question, which is how to approach this.

Also, thanks David, I think Pandoc is the way to go, as ultimately I want to use it to get to Word.

Best

Daniel

p.s. As I wrote this, the markdown in my code samples was getting eaten, so I added some code blocks to make it readable.

Mark,

If you look at the Advanced tab of that dialogue (it’s hidden behind the >> in your screenshot), you’ll find an option to choose a custom processor, which could be CommonMark if you wanted. Trouble is, you’ll still be left with the limited CommonMark, so it’s really not worth doing.

The best advice is still to use one of the more capable formats (MultiMarkdown / GFM / Pandoc) and redirect $HTMLExportCommand accordingly.

1 Like

Agree - and thank you for the helpful pointer to the extra Marked2 Prefs panel. I don’t think any part player here (Tinderbox, Marked2, Markdown) is doing anything wrong as such. Rarher, it is just the defaults are not aligned. Another unknown unknown uncovered!

1 Like

You should find that [^footnote] in the text is translated to [^footnote] in the export.

So, this in the note’s text:

is exported to this (see the Export panel):


And Marked renders it as this.

HTH.

Dear Folks,

After I’ve gotten the same markdown processor working both in Tinderbox and Marked 2, the Pandoc flavour of footnotes now renders well in both Tinderbox and in Marked 2.

In short:

I can write a footnote like this.^[Footnote text goes here]

Which renders well. So, I don’t need to trouble shoot the ^ issue anymore.

Thanks to you both for getting me on the right track.

For anyone who wants to do this.

You’ll need to install pandoc. (I just download the package from the pandoc website.)

You’ll need to set a notes HTML Export Command to:

/usr/local/bin/pandoc -f markdown -t html

You’ll need to set the custom processor in Marked 2

Path: /usr/local/bin/pandoc
Args: -f markdown

In my case, sandboxing breaks this App Store version of Marked 2 for using custom processors, so I launched it via set app.

Anyway, for anyone wondering, a screen shot:

Daniel

2 Likes

I’ve sorted it out.

MultiMarkDown allows footnotes to have text as an anchor.

Screen Shot 2021-12-12 at 12.11.46 PM

But, in Tinderbox, this does not work! A ^ followed by a letter confuses matters, which gives a garbage result.

Screen Shot 2021-12-12 at 12.11.51 PM

If we use a number, things work well.

Screen Shot 2021-12-12 at 12.13.05 PM

Produces:

Screen Shot 2021-12-12 at 12.13.08 PM

A nice work around, use a non letter character after the ^. e.g. an underscore seems to work.

Screen Shot 2021-12-12 at 12.15.03 PM

Problem solved. To think, this has bedevilled me for years.

Tomorrow I can go solve the thing I actually want to do. Which is generate footnotes on the fly via links.

1 Like

It’s the weekend and v9.1.0, a big release, just pushed on Friday. I’d assume this should work but not sure what is happening. If the Tinderbox HTML parser runs before Markdown parsing, thenm you do need to escape the caret. So…

I forgot to mention that you can indeed escape a literal caret, e.g in $Text (your Markdown!), by simply using two carets.

So, worth trying try:

I can write a footnote thus.[^^name]

1 Like

I forgot to mention that you can indeed escape a literal caret, e.g in $Text (your Markdown!), by simply using two carets.

Wonderful. That’s what I was looking for.

1 Like

HI @dtubb I am doing exactly what you are doing. If you’re looking to go from TBX to Word and leverage citations and footnotes your best bet is to use Pandoc. Please see my related videos on citation management, pandoc, and footnoting: Mastering Tinderbox: Training Videos (Complete List). If you’re interested, let’s hope on a call one of these days and we can compare notes. We can also pull in @lfriedla, who is also working on something similar.

See:

1 Like

Hi @satikusala (Michael) that would be a lot of fun. I’ve long been a Tinderbox user, but only just registered for the forum, and discovered your videos. Bravo. Lots of great work. I think a call would be a great idea. The next couple weeks are good. It’d be great to chat with @lfriedla as well. Is there a way to communicate, offline or via direct message?

Happy to set up a meeting. Lew