Inline code in org-mode

前端 未结 2 356
耶瑟儿~
耶瑟儿~ 2021-01-30 01:22

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

I know about source-code blocks:

#+begin_example
blah-blah         


        
2条回答
  •  不思量自难忘°
    2021-01-30 01:49

    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]{text}.

    Edit: Code highlighting of inline code is certainly possible, albeit with patching org.el itself: The answer given here https://stackoverflow.com/a/20652913/594138 works as advertised, turning

    - Inline code src_sh[:exports code]{echo -e "test"}
    

    Into

    in html-export. And the winning answer in this post, https://stackoverflow.com/a/28059832/594138, achieves the same without the need to patch org.el, but you will have to adapt it if you don't like the optics during editing.

提交回复
热议问题