positron-solutions / dslide

Present anything Emacs can do with programmable, extensible, configurable slides made from org mode headings
GNU General Public License v3.0
92 stars 2 forks source link

Slide with babel results but not source? #1

Closed acowley closed 3 months ago

acowley commented 4 months ago

Thank you for sharing this package! Something I'm running into is that I often have parts of an org document that I'd like to hide from the presentation. I'm not sure how to entirely skip over certain headings during a presentation (I can set the action to nil and have a blank screen), but the trickier one is that I often have a src block that generates a figure, and I would like the slide contents to be a title and the figure image, without the code. Is this an available slide style that I just haven't noticed yet?

psionic-k commented 4 months ago

https://github.com/positron-solutions/dslide/blob/master/test/demo.org#hidden-babel-slide

The hidden babel slide is an example of hiding some babel blocks and using them to change the contents of the parent.

For a more blunt solution, let's assume you want the figure to appear immediately. You don't need a child heading. Instead, you can make the babel block hide itself:

* Clandestine Babel
:PROPERTIES:
:DSLIDE_SECTION_ACTIONS: dslide-action-babel
:END:
Since the document is made out of Elisp, it can hide its own contents during the begin and end, so you will never see the babel block that does not exist below:
#+attr_dslide: begin end
#+begin_src elisp :results none
  ;; you can run this expression before or after the block you want to hide
  (let* ((block (org-element-at-point))
         (overlay (make-overlay (org-element-property :begin block)
                                (org-element-property :end block))))
    (overlay-put overlay 'display "")
    (push overlay dslide--overlays))
#+end_src

I think I will add a behavior to hide labelled elements.

I may also enable the babel block action to work as a child action. In my imagination, it feels cleaner if the babel blocks are stored in a child heading that is never seen. Do others feel this way? :rocket:

acowley commented 4 months ago

Thank you for explaining! I did consider the hidden babel slide in the demo, but it was more complexity than I was hoping for. I was thinking of this as a kind of export scenario, where the block header :exports flag controls things quite nicely. I think the use-case of having code generate figures for slides is common enough to specifically consider.

To clarify: I'm suggesting to support :exports results, for example. This is how one can have babel blocks produce figures in org-reveal or org-re-reveal without the code being part of the slide.

psionic-k commented 4 months ago

This makes sense, though I don't use that :exports property. I am giving the mailing list some time to provide feedback regarding whether it's consistent with use.

I do intend to support hiding directly. I've found it to be too useful to remain hidden away in master-of-ceremonies.

I might actually deprecate that style of "hidden babel" as I found an annoyance about its implementation.

psionic-k commented 4 months ago

Check the behavior I experimentally implemented in https://github.com/positron-solutions/dslide/tree/babel-results-and-exports

The last two commits are regarding results handling and exports.

It's just a rough sketch implementation:

psionic-k commented 3 months ago

:exports none and :exports results are now supported in master. There are more examples and new capabilities in the demo.org. Cheers!

If there's related asks, please re-open or file a new issue.