无法将组织模式导出为可折叠 HTML

Cannot export org mode to collapsible HTML

我正在尝试为从 org-mode 导出的 HTML 文件中的部分提供基本的 collapsing/folding 功能,因为我要共享的文件非常大。我在 Mac.

上使用 Emacs 26.2 (9.0) 和 Org 9.1.9

这似乎是邮件列表中提到的内置 feature, but I haven't seen any effect from adding #+INFOJS_OPT commands to my org files before exporting to HTML. I also saw another tool,但没有任何示例,我不知道如何将它应用于我拥有的特定组织文件。

例如下面的文件被转换为HTML其中looks identical to the same file without the INFOJS_OPT lines

#+Title+: JS test
#+INFOJS_OPT: path:js/org-info.js
#+INFOJS_OPT: toc:nil ltoc:nil view:overview mouse:underline
#+INFOJS_OPT: home:https://orgmode.org buttons:nil
* Chapter 1
** Section 1
*** Part 1
 - csp
** Section 2
 - cs2p

我有一份新下载的 js/org-info.js

生成的HTML略有不同,但这似乎没有影响。我不知道如何折叠结果 HTML - 即使在 org-info.js.

之外也对解决方案开放

似乎 org-info.js 不再维护了。他们在这里为任何愿意 tweak/update 的人提供 JavaScript 中的源代码。

https://lists.gnu.org/r/emacs-orgmode/2017-07/msg00049.html

幸运的是有人更新了它(感谢 Daniel Clemente!)。

程序是:

#+HTML_HEAD_EXTRA: <script type="text/javascript"  src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
#+HTML_HEAD_EXTRA: <script type="text/javascript" src="esquemadorg.js"></script>

确保 src="esquemadorg.js" 指向文件 相对于 html 导出文件所在的位置

一些西班牙语(或葡萄牙语?)文本将出现在导出的文档中。您可以在 esquemadorg.js 文件中进行全面搜索并将其更改为英文。我的现在看起来像这样。

    par.append(document.createTextNode("Press on a section header to collaps/expand it."));
    par.append( $( document.createElement('a') ).text(" COLLAPSE ALL ").addClass("globalexpandtool").click(close_all_sections));
    par.append( $( document.createElement('a') ).text(" SHOW ALL  ").addClass("globalexpandtool").click(open_all_sections));
    $("div#table-of-contents").after(par);