Hello Aaron,

On Thu, May 24, 2018 at 2:08 PM Kaushal Modi <kaushal.modi@gmail.com> wrote:
Expanding on your idea.. what if we had another Special block with name summary?

#+begin_details
#+begin_summary
Open for details

More summary.
#+end_summary
Many details here.
#+end_details

From quick testing, this works (doesn't support the div tags for HTML4). The good part is that the "summary" Special Block is automatically handled by ox-html. 

     ((string= block-type "details")
      ;; Recognize Org Special blocks like:
      ;;   #+begin_details
      ;;   #+begin_summary
      ;;   This is summary.
      ;;   #+end_summary
      ;;   Here are the details.
      ;;   #+end_details
      (let* ((is-open (member "open" (org-element-property :attr_html special-block)))
             (str1 (org-blackfriday-special-block special-block contents nil))
             ;; Insert a new-line before the closing </details> tag
             ;; for correct Markdown parsing for cases when the
             ;; Special Block content ends a code block. Without this
             ;; inserted newline, the Markdown converted content will
             ;; look like below, and Blackfriday won't parse it
             ;; correctly.
             ;;   ```emacs-lisp
             ;;   (message "a code block")
             ;;   ```</details>
             ;; A closing </p> tag is also added.. the opening <p>
             ;; tag is later added in the `str2' var if summary is
             ;; present, else in `str3' var.
             (str1 (replace-regexp-in-string "</details>\\'" "\n</p>\\&" str1))
             ;; Detect the summary closing tag "</summary>".
             ;; Also add the opening <p> tag with "details" class
             ;; so that just as CSS rules can be set for summary
             ;; ("details summary"), they can be set for the details
             ;; portion following the <summary> too, using "details
             ;; .details".
             (str2 (replace-regexp-in-string
                    "\\(<summary>\\(.\\|\n\\)*</summary>\\)"
                    "\\1<p class=\"details\">"
                    str1)))
        ;; (message "[DBG details/summary]: is-open:%S `%s' `%s'" is-open str1 str2)
        (if is-open
            (replace-regexp-in-string "\\`\\(<details\\)>" "\\1 open>" str2)
          str2)))

Also, thinking about HTML4 support, as details and summary tags were added in HTML5, the "support" would be simply to and the (string= block-type "details") condition with org-html-html5-fancy or equivalent. So then for HTML4, details and summary Special Blocks will simply be div tags.
--

Kaushal Modi