This is a follow-up question from this: Replace \LaTeX command in HTML export
Consider following org-mode file:
* Text about exporting from org-mode to \LaTeX text * Text about exporting from org-mode to HTML another text
If I export this file to HTML and also use filter to replace "\LaTeX" in heading with simple "LaTeX", I end up with table of contents entries that still contain "\LaTeX" as a string, instead of the replacement "LaTeX."
I should also add that I am using Doom Emacs and I am running Emacs in non-interactive session through
makefile (I am doing multiple exports to multiple export formats).
Looking to org-manual about TOC, I could use property
ALT_TITLE (org TOC), but because I am exporting also to LaTeX, that would mean I would lost formatting in there.
I reused filter fom linked question:
(require 'ox) (require 'ox-html) (defun my-latex-filter-example (text backend info) "Replace \LaTeX with \"LaTeX\" in HTML output." (when (org-export-derived-backend-p backend 'html) (replace-regexp-in-string "\\\\LaTeX" "LaTeX" text))) (add-to-list 'org-export-filter-link-functions 'my-latex-filter-example)
According to optons listed in manual: Advanced Export I have also tryied
org-export-filter-functions, but none were able to remove string "\LaTeX" from HTML table of contents.
Is there a way to target with filter functions links generated by TOC in HTML?