0

I want to export org texts to HTML. This is easy if I use org-export-string-as. The problem is, the org texts may contain unreferenced footnotes, I want the export function to ignore the footnotes. Here is my code:

(let ((org-text (concat "* Header\n" "Text[fn:1]."))
      (my-backend (org-export-create-backend
                   :parent 'html
                   :transcoders '((footnote-reference . ignore)))))
  (org-export-string-as org-text my-backend t nil))

As you can see, I set the transcoder of footnote-reference to ignore, but it doesn't work. I still got an error when running the above code:

Definition not found for footnote 1

Why? What should I do?

1
  • Did you try to set org-export-with-footnotes to nil? Or in the buffer, #+OPTIONS: f:nil?
    – NickD
    Oct 18, 2021 at 16:20

1 Answer 1

1

Setting org-export-with-footnotes to nil seems to work fine:

(let ((org-text (concat "* Header\n" "Text[fn:1]."))
      (my-backend (org-export-create-backend
                   :parent 'html
                   ;;:transcoders '((footnote-reference . ignore))
                   ))
      (org-export-with-footnotes nil))
  (org-export-string-as org-text my-backend t nil))

It produces:

"<div id=\"table-of-contents\" role=\"doc-toc\">
<h2>Table of Contents</h2>
<div id=\"text-table-of-contents\" role=\"doc-toc\">
<ul>
<li><a href=\"#org27ffc60\">1. Header</a></li>
</ul>
</div>
</div>
<div id=\"outline-container-org27ffc60\" class=\"outline-2\">
<h2 id=\"org27ffc60\"><span class=\"section-number-2\">1.</span> Header</h2>
<div class=\"outline-text-2\" id=\"text-1\">
<p>
Text.</p>
</div>
</div>
"

Of course, you don't need my-backend any longer, but I left that in just in case you have other things up your sleeve :-)

1
  • It works, thanks!
    – Searene
    Oct 19, 2021 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.