emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Setting language on result of code block
@ 2020-08-02 20:47 Magnus Therning
  2020-08-02 20:54 ` John Herrlin
  0 siblings, 1 reply; 2+ messages in thread
From: Magnus Therning @ 2020-08-02 20:47 UTC (permalink / raw)
  To: Emacs Org Mode mailing list

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

Is there some way to specify the language on the result of a code block.
For instance, if the block

#+begin_src bash
aws --endpoint-url=http://localhost:4566 sns create-topic --name the-topic
#+end_src

gives the result

#+RESULTS:
#+begin_example
{
    "TopicArn": "arn:aws:sns:eu-central-1:000000000000:the-topic"
}
#+end_example

Is there some way I can specify that the result is JSON? That is get the
result

#+RESULTS:
#+begin_example json
{
    "TopicArn": "arn:aws:sns:eu-central-1:000000000000:the-topic"
}
#+end_example

/M

--
Magnus Therning              OpenPGP: 0x927912051716CE39
email: magnus@therning.org
twitter: magthe              http://magnus.therning.org/

Every act of creation is first an act of destruction.
     — Pablo Picasso

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

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

* Re: Setting language on result of code block
  2020-08-02 20:47 Setting language on result of code block Magnus Therning
@ 2020-08-02 20:54 ` John Herrlin
  0 siblings, 0 replies; 2+ messages in thread
From: John Herrlin @ 2020-08-02 20:54 UTC (permalink / raw)
  To: Magnus Therning; +Cc: emacs-orgmode


You can use =:wrap= for that.

Here is the docs: https://orgmode.org/manual/Results-of-Evaluation.html

And here is an example.

#+BEGIN_SRC shell :results output :wrap example json
curl http://ip.jsontest.com/
#+END_SRC

#+RESULTS:
#+begin_example json
{"ip": "8.8.8.8"}
#+end_example

Best regards
John

Magnus Therning <magnus@therning.org> writes:

> Is there some way to specify the language on the result of a code block.
> For instance, if the block
>
> #+begin_src bash
> aws --endpoint-url=http://localhost:4566 sns create-topic --name the-topic
> #+end_src
>
> gives the result
>
> #+RESULTS:
> #+begin_example
> {
>     "TopicArn": "arn:aws:sns:eu-central-1:000000000000:the-topic"
> }
> #+end_example
>
> Is there some way I can specify that the result is JSON? That is get the
> result
>
> #+RESULTS:
> #+begin_example json
> {
>     "TopicArn": "arn:aws:sns:eu-central-1:000000000000:the-topic"
> }
> #+end_example
>
> /M


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

end of thread, other threads:[~2020-08-02 20:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-02 20:47 Setting language on result of code block Magnus Therning
2020-08-02 20:54 ` John Herrlin

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).