0

I have an org mode document, and I'd like to have a block showing some org syntax that isn't interpreted as part of the overall document. I want to do something like:

** enclosing document heading
Here's some example org mode syntax stuff:

#+begin_?????
* Parent, not interpreted as part of the enclosing document
:PROPERTIES:
:ID: abc
:END:
** Child 1
** Child 2
#+end_?????

** sibling of the above "enclosing" two-star heading, not a child of "parent"

What can I use for ????? to include example org mode syntax that's not parsed as part of the overall document? That is, I don't want that "parent" headline to "count".

I understand there's escaping trickiness. Is there a good approach for this?

1
  • 1
    You can quote lines in EXAMPLE blocks that would be confused with Org markup by prefixing a , to them. See Literal Examples. The comma is stripped when you export.
    – NickD
    Commented Jun 2 at 18:03

1 Answer 1

0

Copying @NickD's comment to an answer: using an example block and prefixing the lines with commas does this.

#+begin_example
,* Parent, not interpreted as part of the enclosing document
:PROPERTIES:
:ID: abc
:END:
,** Child 1
,** Child 2
#+end_example

OTOH, if you don't care about exporting (I don't), you can be more consistent and rectangle-mode-friendly by using a comma on every line:

#+begin_example
,* Parent, not interpreted as part of the enclosing document
,:PROPERTIES:
,:ID: abc
,:END:
,** Child 1
,** Child 2
#+end_example

That looks nice in emacs, but keep in mind that when exporting, the commas on lines without org structure syntax will get exported.

4
  • The first form does not work properly: if you export e.g. to PDF, the comma remains on the property lines. You need to do it the second way.
    – NickD
    Commented Jun 4 at 1:18
  • Please fix your answer: I added warnings in various places, but it would be better if you went back and fixed it properly.
    – NickD
    Commented Jun 5 at 17:06
  • Fixed; since I never export my org files (I just use them for notes) I didn't notice that problem.
    – Dan Drake
    Commented Jun 7 at 12:49
  • You can (and should) accept your own answer: see Accepting an answer and links therein. It's part of what makes the site work.
    – NickD
    Commented Jul 1 at 16:28

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.