intra-document-link.tbx (57.2 KB) is a really simple document - there’s a parent note, and a child note. The child note has a text link to the parent note. Using the built in HTML template, the parent HTML produces:
<h1>Parent</h1>
<h2>Child</h2>
<p>Child links back to <a href="#">parent</a>… but the link doesn’t really go anywhere.</p>
You can see that the text link becomes <a href="#">parent</a>, which isn’t really useful at all.
Ideally, there’d be some way for the link to produce an anchor that goes back to the parent header. But barring that, I’d rather just not have the link tag in there at all.
Is there a setting or attribute that will change the behavior of this “link to nowhere” within a document?
Do you want intra-page jump links - or not. If the former, Tinderbox’s Help’s source TBX file aims to resolve just that issue - if you publish a composite page, how to retain notes between Tinderbox notes that are now links within a single HTML page. The technique does need some post-processing, as Tinderbox has never supported creating links to page anchors (without user configured post-processing).
If you want no link at all, I don’t think that’s possible as link creation is part of the overall HTML processing of $Text.
Let me go look. There’s nothing special - it just takes a little while to write (and more importantly - check) a new demo from scratch.
The second half of the process is the sed command in the TXT file to which I linked. I’ll see what I did at the template end. IIRC I seeded the $ID into the HTML and used the sed to matching the #anchor value.
More in a bit.
Footnote: $ID is intrinsic so differs between aliases and originals, so may result in unexpected links unless you plan carefully.
Ah, I think I too had $ID related issues so the TBX help file has aString attribute $AnchorName. A query finds all relevant (i.e. exporting) notes and has this action (which could equally well be a rule or edict):
Basically, we take the filename of the to-be-exported single HTML page and remove the file extension. Warning: Tinderbox only dupes exported HTML filenames at container scope, thus you need to consider if you have non-unique note names in your exporting pages and act accordingly**.
In our exporting templates, the recursing inner template includes this element for each note***:
The ‘x’ preface in the id value is to ensure the value string is W3C standards compliant. I’m not sure about the $IsAlias fork in the text - I think we avoided alias issues by avoiding using them (or not trying to link to them). Having exported our single page of HTML, we then run this command line on it in Terminal:
sed -E 's:href=\"help[^\.]*\/([^\.]+)\.html\":href=\"#x\1\":g' print-export-source.html > print-export-source-proc.html
** this sort of gnarly edge case is, I suspect, one reason such a feature isn’t baked into the app as export can get quite nuanced and complex without an inexpert user realising (with resultant support issues arising).
*** IIRC we avoided aliases to simplify the problem of duplicated content and broken links
If you do need aliases and/or duplicate note titles, I suggest getting your export to work without them and then add in the extra aspects so you can more easily see where breakage occurs and get ideas as how to resolve that.