Hello, Rasmus <ras...@gmx.us> writes:
> Further, IMO it might be better to extend the ’#+toc: headlines local’ > declaration. Of course you could argue that ’local’ becomes a special > case of the above "id:whatever-is-the-name-of-the-local-headline". > > Personally, I would like a more explicit syntax, though I recognize that > it doesn’t necessarily make a difference if it’s an extension, in the > sense of suffixing. E.g.: > > #+toc: headlines local 1 :headline "* my headline" > #+toc: headlines local 1 :headline "#headline" > > Or closer to your suggestion, > > #+toc: headlines 1 :headline "#headline" > #+toc: headlines 1 :headline local > > Which as a special case can be written as, > > #+toc: headlines 1 local I agree. However, I suggest to ignore quotes: #+toc: headlines 1 :headline #headline or #+toc: headlines 1 :target #headline since TOC keywords always refer to headlines. Using quotes may also be supported for destinations containing spaces. >> + (org-html-toc depth info >> + (or >> + (and local-id >> + (car (org-element-map (plist-get info >> :parse-tree) >> + 'headline >> + (lambda (element) >> + (and (string= (org-element-property >> :CUSTOM_ID element) local-id) >> + element))))) > > Wouldn’t it better to use org-link-search and get the element at > point? Or even work at the parse tree level and use `org-export-resolve-id-link' and `org-export-resolve-fuzzy-link'. Regards, -- Nicolas Goaziou