Search code examples
githubmarkdownorg-mode

Is there any way to show collapsible contents in github README.org (org-mode)?


I come from emacs org-mode and I really love using it on github README. The problem is that I found that in markdown github README.md file, one can use:

<details>
    <summary>Title</summary>
    contents
</details>

to show collapsible contents which is very useful in various situations. However, I cannot find how to implement this collapsible function in README.org(org-mode). Can anyone help me?


Solution

  • I have commented in the GH issue you've created here: https://github.com/github/markup/issues/1451

    Let me repeat that here for posterity:

    It looks like there are two ways to achieve this. Note that I have performed only limited testing by pushing a single .org file to GitHub. I don't know yet if this works in issues, PRs, etc.

    You can inline it like this:

    #+HTML: <details> <summary> Click me</summary> and this part should be collapsed </details>
    

    But there's no use for it since everything has to be on the same line. However, this:

    #+begin_html
      <details>
        <summary>
        Click me
        </summary>
        And this stuff will be collapsed.
        
        Nullam eu ante vel est convallis dignissim. Fusce suscipit, wisi nec facilisis
        facilisis, est dui fermentum leo, quis tempor ligula erat quis odio. Nunc porta
        vulputate tellus. Nunc rutrum turpis sed pede. Sed bibendum. Aliquam posuere. Nunc
        aliquet, augue nec adipiscing interdum, lacus tellus malesuada massa, quis varius mi
        purus non odio. Pellentesque condimentum, magna ut suscipit hendrerit, ipsum augue
        ornare nulla, non luctus diam neque sit amet urna. Curabitur vulputate vestibulum
        lorem. Fusce sagittis, libero non molestie mollis, magna orci ultrices dolor, at
        vulputate neque nulla lacinia eros. Sed id ligula quis est convallis tempor. Curabitur
        lacinia pulvinar nibh. Nam a sapien.
    
      </details>
    #+end_html
    

    For some mysterious reason appears to work