Inline code in org-mode

2019-03-08 07:20发布

问题:

Markdown allows for embedded code. How can this be done in org-mode?

I know about source-code blocks:

#+begin_example
blah-blah
#+end_example

But what I want is something like this (obviously, with the right syntax, which I do not know):

This is `embeded code`.

Can this be done in org-mode? Not possible to find that in the documentation ...

回答1:

You can enclose the text within = or ~ signs to have it typeset in monospaced font and export it verbatim (which means it is not processed for org-specific syntax):

This is =verbatim text= or ~code~.

You'll find all information about org-mode markup elements in the relevant section of the manual.



回答2:

While monospaced is good enough for most cases, inline code blocks have the form src_LANG[headers]{your code}. For example, src_xml[:exports code]{<tag>text</tag>}.