From v9.5.0, Tinderbox takes a new approach to export preview. The guiding principle is that Preview should now be readily available for any note, without configuration and without understanding templates. Where in the past this happened behind the scenes, Tinderbox now creates templates that operate normally and that can be extended and modified.
In overview, Preview is now much simpler to use. If there in not already have a template, Tinderbox will add built-in simple template into
/Templates/Preview. That template can be customised if desired but this is not a requirement for use of Preview. Similarly, if the document does not yet have an export folder set, Tinderbox makes a temporary folder for the preview, and cleans up after preview is no longer in use. This process is explored in more detail below.
Template (and CSS styling) assignment
If a note is previewed and it has an assigned export template, Tinderbox continues to use that template. This is essentially the original use, that of checking (HTML) files before export.
If a note is previewed but has no assigned export template, Tinderbox adds a built-in template 'Preview' to
/Templates/Preview. If the latter does not already exist, Tinderbox does the following:
- if not present, the Hints container is added to the document.
/Hints/Preview/styleis makes a new note, which contains a style sheet that is automatically included in the preview template.
- assigns the newly-created 'preview' template to the previewed note. If either or both of these notes exists ('preview', and or 'style', the pre-existing note is used.
Both the template and the CSS styles can be altered by the user. To reset to the original would involved deleting either file and re-invoking its addition. Hint: perhaps keep a copy of the original alongside the edited version using a different $Name for the note with the original data.
Note: in older versions the preview template was stored under Hints at
Support for legacy markdown stylesheets, stored in the application support Markdown folder, has been discontinued. Copy any preferred style definitions to
Preview character encoding
if a previewed note's template has no character encoding tag (e.g.
), Tinderbox adds a preview-only framework to ensure that the preview pane uses the expected character encoding. This stops non-ASCII characters appearing corrupted in the preview.
Files generated via use of preview
When previewing HTML for a document that has an export folder, Preview now exports (a) the current page, and (b) any pages to which the current page has text links, if those pages are not currently already exported to disk. If the current page is already present on disk, the current version is saved and exported later (i.e. reverting back over the preview file.This stops preview of possible changes from overwriting a previous 'good' copy of the export file.
If there is no pre-existing export the new preview file is left in the export location. In addition, previewing any note will generate and file at the export location.
If there is no export folder defined for the document, Tinderbox uses a hidden temporary folder to hold the exported files and cleans up afterwards.
Why do this? This arcane waltz is necessitated by ill-documented macOS security measures which appear to offer little if any benefit to security, but which consumes time and resources that might do someone, somewhere, some good. So, not ideal, but forced by macOS limitations.
Considerations for users of both preview and export
Because preview activity may result in files in the export location that are not the result of deliberate export, users are advised to delete any current exported files before doing a full export of a document. Given the speed of export now, re-doing all files has little difference on the time taken.