This version is out of date, covering development from v5.0.0 to v5.12.2. It is maintained here only for inbound reference links from elsewhere.

Jump to the current version of aTbRef.

Tinderbox Icon

Exporting code samples

Normally, Tinderbox lets you embed html in your notes, and exports that embedded HTML without change.

Inline code examples

Sometimes, though, you want to show an example of your HTML (or some other programming language) on a web page. That means you want the HTML tags to appear as you see them in Tinderbox, i.e. you see the character sequence "<b>", not the effect of bolding some text.

Originally, setting $HTMLQuoteHTML to false let you export HTML examples in an entire note. But, sometimes, you want the example to be handled differently than the rest of the note so Tinderbox also allows these usages:

Setting $HTMLQuoteHTML to true will override this feature - so don't mix the two!

Note that if you use <code> for a single line sample, you won't emit a wrapping <p> tag as Tinderbox doesn't emit an 'auto-paragraph' if:

So, if you want such a single line code example emitted as a separate paragraph, place an option+space at the end of the line after the </code> tag. Tinderbox will detect this and add the <p> tags; even better, if the line starts with a tab it will use your TBX's defined indented-paragraph styling.

Whole note code samples

Alternatively, you may have a note consisting entirely of code (HTML, XML, etc) that needs to be exported verbatim, e.g. as is a boilerplate include to a larger exported page. In this case the best approach is to turn off $HTMLMarkupText (i.e. set to false). This should ensure the pages characters are exported untouched. However, characters outside the low ASCII set, such as a • may get transposed to a Unicode-style HTML entity. If you want to use $HTMLMarkupText but have paragraphs starting with *, # or • you can just set $AutomaticIndent to false.


Possible relevant notes (via "Similar Notes" feature):


A Tinderbox Reference File : Import/Export/Formatting : Exporting code samples