emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Quoting a REPL session in an org document
@ 2018-04-20  9:27 Dov Grobgeld
  2018-04-20 10:48 ` Diego Zamboni
  0 siblings, 1 reply; 2+ messages in thread
From: Dov Grobgeld @ 2018-04-20  9:27 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1148 bytes --]

Hello,

I wonder if there is a "standard" way of quoting a REPL session in an org
document. Right now I'm using #example, but I wonder if there is something
richer. The ideal would be to get something that is syntax aware so that
anything after the "prompt" is syntax highlighted.

Here is an example of a session that I would like to include literally in
my document:

$ ipython
Python 2.7.14 (default, Mar 14 2018, 13:36:31)
Type "copyright", "credits" or "license" for more information.
IPython 5.3.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
In [1]: import pandas as pd
In [2]: df = pd.read_csv('/tmp/foo.csv')
In [3]: df
Out[3]:
  Animal  Weight        Color
0   Bear     200        Brown
1    Cat       5       Orange
2    Dog      10  Black&White
In [4]:

I would e.g. like this to look as follows in the exported document (but
with colored selectable text, not through an image!):


​
Thanks in advance!
Dov

[-- Attachment #1.2: Type: text/html, Size: 2205 bytes --]

[-- Attachment #2: foo.png --]
[-- Type: image/png, Size: 24389 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Quoting a REPL session in an org document
  2018-04-20  9:27 Quoting a REPL session in an org document Dov Grobgeld
@ 2018-04-20 10:48 ` Diego Zamboni
  0 siblings, 0 replies; 2+ messages in thread
From: Diego Zamboni @ 2018-04-20 10:48 UTC (permalink / raw)
  To: Dov Grobgeld; +Cc: Diego Zamboni, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]

Hi Dov,

I think the easiest way is to use a SRC block with a mode that understands the iPython-REPL format - this would give you not only syntax highlighting, but also the possibility of executing code from Org-mode using org-babel. A quick search reveals two likely candidates:

https://github.com/millejoh/emacs-ipython-notebook <https://github.com/millejoh/emacs-ipython-notebook>
	Org-mode integration: http://millejoh.github.io/emacs-ipython-notebook/#org-mode-integration <http://millejoh.github.io/emacs-ipython-notebook/#org-mode-integration>
https://github.com/gregsexton/ob-ipython/ <https://github.com/gregsexton/ob-ipython/>

Best,
—Diego


> On 20 Apr 2018, at 11:27, Dov Grobgeld <dov.grobgeld@gmail.com> wrote:
> 
> Hello,
> 
> I wonder if there is a "standard" way of quoting a REPL session in an org document. Right now I'm using #example, but I wonder if there is something richer. The ideal would be to get something that is syntax aware so that anything after the "prompt" is syntax highlighted.
> 
> Here is an example of a session that I would like to include literally in my document:
> 
> $ ipython
> Python 2.7.14 (default, Mar 14 2018, 13:36:31)
> Type "copyright", "credits" or "license" for more information.
> IPython 5.3.0 -- An enhanced Interactive Python.
> ?         -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help      -> Python's own help system.
> object?   -> Details about 'object', use 'object??' for extra details.
> In [1]: import pandas as pd
> In [2]: df = pd.read_csv('/tmp/foo.csv')
> In [3]: df
> Out[3]:
>   Animal  Weight        Color
> 0   Bear     200        Brown
> 1    Cat       5       Orange
> 2    Dog      10  Black&White
> In [4]:
> 
> I would e.g. like this to look as follows in the exported document (but with colored selectable text, not through an image!):
> 
> <foo.png>
> ​
> Thanks in advance!
> Dov


[-- Attachment #2: Type: text/html, Size: 4158 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-20 10:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-20  9:27 Quoting a REPL session in an org document Dov Grobgeld
2018-04-20 10:48 ` Diego Zamboni

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).