In blogs, textbooks, etc, it's really common to display the results of some code as comments, e.g.:
(+ 1 1) ;=> 2
Is there a way to display results like this automatically using Org-Mode's Babel feature?
Specifically, what I'd like is to be able to specify a header such that this:
#+begin_src scheme <some headers>
(+ 1 1)
(/ 4 (* 2 2))
#+end_src
Would turn into the following when I C-c C-c
:
#+begin_src scheme <some headers>
(+ 1 1) ;=> 2
(/ 4 (* 2 2)) ;=> 1
#+end_src
And then if I made some changes, like so...
#+begin_src scheme <some headers>
(+ 1 5) ;=> 2
(/ 8 (* 2 2)) ;=> 1
#+end_src
...and C-c C-c
, it would replace the comments with updated ones:
#+begin_src scheme <some headers>
(+ 1 5) ;=> 6
(/ 8 (* 2 2)) ;=> 2
#+end_src
Or, short of what I've dreamed up above, is there an easy way to have results displayed by github's org file renderer, so the following would be visible (ideally with formatting that I specify at the document level):
#+RESULTS:
: 2