In org-mode when I type following example code:

#+begin_src python
def main(*args):
    from brownie import network, project

it will be previewed as, equivalent for Code Sample in markdown: enter image description here

Would it be possible to achieve this for a singe for word or line LIKE_THIS code sample inside of a line:

Test Hello World Doo Test.

On the other hand preview of org mode: ![enter image description here

When I try following LIKE_THIS in the org mode I see following in the preview: enter image description here

I have tried following which did not work:

#+begin_src python LIKE_THIS #+end_src

which printed just a new line inside a code piece:

enter image description here

  • I don't understand your question. When you refer to a 'preview', are you talking about exporting the file? If so, to what format: pdf, html, something else?
    – Tyler
    Commented Oct 20, 2021 at 16:33
  • 1
    The markup for inline source code is src_<language>{<body>}, i.e., src_python{LIKE_THIS}
    – Tyler
    Commented Oct 20, 2021 at 16:34
  • @Tyler Format could be pdf or ex: README.org file's view on the github.
    – alper
    Commented Oct 20, 2021 at 19:55

1 Answer 1


Markup for generic code in Org is either =code= or ~code~. If you want to execute that code, then src_python{print("Hello, world")}, and you can C-c C-c on that line, and it will evaluate and print the results within that sentence. See more at https://orgmode.org/manual/Structure-of-Code-Blocks.html

  • ~code~ was excatly what I was looking for
    – alper
    Commented Oct 22, 2021 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.