A reference document providing a formal description of Org’s syntax is available as a draft on Worg, written and maintained by Nicolas Goaziou. It defines Org’s core internal concepts such as “headlines”, “sections”, “affiliated keywords”, “(greater) elements” and “objects”. Each part of an Org document belongs to one of the previous categories.
To explore the abstract structure of an Org buffer, run this in a buffer:
M-: (org-element-parse-buffer) <RET>
It outputs a list containing the buffer’s content represented as an abstract structure. The export engine relies on the information stored in this list. Most interactive commands—e.g., for structure editing—also rely on the syntactic meaning of the surrounding context.
You can probe the syntax of your documents with the command
M-x org-lint <RET>
It runs a number of checks to find common mistakes. It then displays their location in a dedicated buffer, along with a description and a “trust level”, since false-positive are possible. From there, you can operate on the reports with the following keys:
|Display the offending line
|Move point to the offending line
|Check the document again
|Hide all reports from the same checker
|Also remove them from all subsequent checks
|Sort reports by the column at point