Cool! I was inspired by this to try it with Python doctests. Check out the result here: http://kitchingroup.cheme.cmu.edu/blog/2018/05/17/Literate-programming-with-python-doctests/

Note: I thought I had sent this email before, but it appeared as a draft just now, so I am just sending it again.

John

-----------------------------------
Professor John Kitchin 
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803

On Thu, May 17, 2018 at 2:33 AM, ZHUO QL (KDr2) <zhuoql@yahoo.com> wrote:
Thanks, that works perfectly. I made a simple summary of this thread on my site: http://kdr2.com/tech/emacs/1805-approach-org-ref-code-to-text.html


Greetings.

ZHUO QL (KDr2, http://kdr2.com)



On Thursday, May 17, 2018, 11:11:39 AM GMT+8, John Kitchin <jkitchin@andrew.cmu.edu> wrote:


I believe you can do that with the Library of Babel (https://orgmode.org/worg/org-contrib/babel/library-of-babel.html)

John

-----------------------------------
Professor John Kitchin 
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803