Tinderbox Forum

Mapping Tinderbox note structure into Markdown structure

TB 9 brings with it new capabilities for taking notes in Markdown. I understand how to write Markdown text in a single note and render it (thanks for instance to @satikusala’s new video and other postings). What I’ve not yet understood is how to map a TB structure with containers each holding notes in markdown format to a complete document.

As an example consider the following example file structure.

You see that Notes 1, 11, 2 and 3 all contain a mixture of Level-1 headings ( a single #), Level-2 headings ( two ##'s) + some text. I would like to see the structure of the TB document reflected in the embedding of the titles. For instance the Note 11 which includes # Title 1 should actually be rendered as ## Title 1 in the export because Note 11 is a child of container of Note 1.

Another approach that I was looking for but have not found is to use each note $Name as the heading with the embedding in the TB file determining the heading level e.g. top level container Heading 1, children Heading 2 and any headings within $Text given one heading level less than the note name.

Not sure whether I’m making sense to others. I believe there is something similar for HTML export where each children note has a heading level one less than the container.

Hey @mdavidson, great question. Try clicking on the preview tab. This will tell TBX to render the notes using your marketing templates and settings (e.g. you have the Common Mark preview set, etc.).

I’m not sure this is well defined in the general case. But, if I follow you, the export you would like here is

# Note 1
## Title 1
## Note 11
### Title 11
# Note 2
## Title 1
some text
### Title 2
Some text under title 2. A few bullets for good measure

I’m fairly sure we could do this, but is it worth the effort? The same effort could give you an XML or JSON document, which is likely more useful.


The key idea is to select export templates based on the indentation of the note. So, a top-level note exports headings as H1 or #, a second-level note uses a template that exports the same headings as H2 or ##.

Correct in terms of export I would like to see - I’m open in terms of implementation so if it can be done with an export template for each level, fine.

My thinking is that many of my notes act like building blocks of the final report or document. Sometimes Note 1 may be the top note, then I change my mind and decide to move Note 1 somewhere lower in the hierarchy (the Scrivener binder supports this type of revision). It would be useful then that the markdown note + template knows where it is in the overall tree, and adjusts the level of the headings accordingly to create the right output in terms of headings and text.

Hey there, I don’t have time to do a lesson today, but maybe its will help. I’ve pulled a set of cascading markdown templates from one of my files.

TBX L - Cascading Markdown Templates.tbx (117.8 KB)

Hopefully it makes sense, if not I can explain it later.

Thanks I’ll gave it a spin today. I’m not sure I understand how to use the template ? Could you add a few notes to the document to illustrate how these interact with the template ?