开发者

Escaping org-mode example block inside of an example block

If I am writing about emacs org-mode in an org-mode document, how do I properly escape examples. e.g.

#+BEGIN_EXAMPLE 
#+BEGIN_EXAMPLE 
* This is a heading
#+END_EXAMPLE
#+END_E开发者_如何学PythonXAMPLE

should show

#+BEGIN_EXAMPLE  
* This is a heading
#+END_EXAMPLE

but I need to escape the #+END_EXAMPLE somehow. I'm not finding it in the manual.

Thanks!


Hi think you should use #begin_src org, since you want to write Org-Mode snippets.

#+begin_src org
  ,#+BEGIN_EXAMPLE  
  ,* This is a heading
  ,#+END_EXAMPLE
#+end_src

You can easily edit those snippets with M-x `org-edit-special' RET or C-c '.


If the examples are short, you should be able to export them successfully using the alternate form for examples (Literal Examples)

: #+BEGIN_EXAMPLE
: * This is a headline
: #+END_EXAMPLE

Shows the expected

#+BEGIN_EXAMPLE
* This is a heading
#+END_EXAMPLE

Of course if your examples are significantly longer this will not be nearly as convenient. Hopefully you'll only need to escape the #+END_EXAMPLE in short use cases (or use rectangle insert I suppose)


EDIT:

After a bit more testing, you can actually suppress commands on individual lines which will allow for longer example cases.

#+BEGIN_EXAMPLE
#+BEGIN_EXAMPLE
* This is a headline
,#+END_EXAMPLE
#+END_EXAMPLE

Will export as the expected

#+BEGIN_EXAMPLE
* This is a heading
#+END_EXAMPLE

It will also allow for manual indentation of example blocks, if you require more indentation within the block.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜