310 lines
5.2 KiB
Org Mode
310 lines
5.2 KiB
Org Mode
# Org-Mode Syntax Reference
|
|
|
|
This document covers org-mode syntax for creating flashcards.
|
|
|
|
* Headlines
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you create headlines in org-mode?
|
|
** Back
|
|
=* Heading 1= (one asterisk)
|
|
=** Heading 2= (two asterisks)
|
|
=*** Heading 3= (etc.)
|
|
|
|
#+begin_src org
|
|
* Top Level
|
|
** Second Level
|
|
*** Third Level
|
|
#+end_src
|
|
|
|
* Emphasis
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you bold, italic, and code in org-mode?
|
|
** Back
|
|
=*bold*= :: *bold*
|
|
=/italic /= :: /italic/
|
|
=~code~= :: ~code~ (inline code, like backticks)
|
|
==verbatim== :: =verbatim= (literal text)
|
|
=_underline_= :: _underline_
|
|
|
|
* Code Blocks
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you write a source code block in org-mode?
|
|
** Back
|
|
#+begin_src org
|
|
#+begin_src cpp
|
|
std::vector<int> v;
|
|
#+end_src
|
|
#+end_src
|
|
|
|
Supported languages: =cpp=, =c=, =python=, =bash=, =javascript=, =sql=, =json=, =html=, =css=, =rust=, =go=, etc.
|
|
|
|
* Links
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you write links in org-mode?
|
|
** Back
|
|
#+begin_src org
|
|
[[https://example.com][Description]]
|
|
[[https://example.com]] (auto-named)
|
|
[[file:path/to/file.org][Local file]]
|
|
#+end_src
|
|
|
|
* External Links
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you link to external URLs in org-mode?
|
|
** Back
|
|
Plain URL or with description:
|
|
#+begin_src org
|
|
https://example.com
|
|
[[https://example.com][Example Site]]
|
|
#+end_src
|
|
|
|
* Lists
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you write bullet and numbered lists in org-mode?
|
|
** Back
|
|
#+begin_src org
|
|
- Bullet item
|
|
- Another item
|
|
- Sub-item (indent with spaces)
|
|
|
|
1. Numbered item
|
|
2. Second item
|
|
|
|
- [ ] Unchecked task
|
|
- [X] Checked task
|
|
#+end_src
|
|
|
|
* Properties Drawer
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you add properties to a flashcard heading?
|
|
** Back
|
|
#+begin_src org
|
|
* Card Title :tag1:tag2:
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:ANKI_NOTE_ID: 1234567890
|
|
:END:
|
|
** Front
|
|
Question
|
|
** Back
|
|
Answer
|
|
#+end_src
|
|
|
|
Properties drawer goes directly after the heading, before Front.
|
|
|
|
* Tags
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you add tags to a headline?
|
|
** Back
|
|
Tags go after the heading, separated by colons:
|
|
#+begin_src org
|
|
* My Card :cpp:containers:stl:
|
|
#+end_src
|
|
|
|
Tags can be inherited by subheadings.
|
|
|
|
* Flashcard Structure
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
What is the complete structure of an org-mode flashcard?
|
|
** Back
|
|
#+begin_src org
|
|
* Question/Title :tag:
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
The question or prompt
|
|
** Back
|
|
The answer (often includes source blocks)
|
|
|
|
#+begin_src cpp
|
|
code here
|
|
#+end_src
|
|
#+end_src
|
|
|
|
* Export Blocks
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you create a block that exports to a specific format?
|
|
** Back
|
|
#+begin_src org
|
|
#+begin_export html
|
|
HTML content here
|
|
#+end_export
|
|
|
|
#+begin_export latex
|
|
LaTeX content here
|
|
#+end_export
|
|
#+end_src
|
|
|
|
* Comments
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you add comments in org-mode?
|
|
** Back
|
|
#+begin_src org
|
|
#+COMMENT: This entire line is a comment
|
|
|
|
# Also a comment (headline-level)
|
|
#+end_src
|
|
|
|
* Block Quotes
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you create a block quote in org-mode?
|
|
** Back
|
|
#+begin_src org
|
|
#+begin_quote
|
|
Your quote text here.
|
|
It can span multiple lines.
|
|
#+end_quote
|
|
#+end_src
|
|
|
|
* Example Blocks
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you create an example block (literal text)?
|
|
** Back
|
|
#+begin_src org
|
|
#+begin_example
|
|
This text is literal - no emphasis processing.
|
|
*not bold*
|
|
#+end_example
|
|
#+end_src
|
|
|
|
* Horizontal Rules
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you create a horizontal rule in org-mode?
|
|
** Back
|
|
Five or more dashes:
|
|
#+begin_src org
|
|
-----
|
|
#+end_src
|
|
|
|
* Tables
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you create a table in org-mode?
|
|
** Back
|
|
#+begin_src org
|
|
| Header 1 | Header 2 |
|
|
|----------+----------|
|
|
| Cell 1 | Cell 2 |
|
|
| Cell 3 | Cell 4 |
|
|
#+end_src
|
|
|
|
Tables need at least one dash in the separator row.
|
|
|
|
* footnotes
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you add footnotes in org-mode?
|
|
** Back
|
|
#+begin_src org
|
|
Some text with a footnote[fn:1]
|
|
|
|
[fn:1] This is the footnote content.
|
|
#+end_src
|
|
|
|
* Special Symbols
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you insert special symbols in org-mode?
|
|
** Back
|
|
Using org-entities:
|
|
#+begin_src org
|
|
\alpha → \alpha
|
|
\beta → \beta
|
|
\sum → \sum
|
|
\pm → \pm
|
|
\rightarrow → \rightarrow
|
|
#+end_src
|
|
|
|
Also works: =\egal= (𝑎𝑏𝑐), =~abc~= (code)
|
|
|
|
* Todo States
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you mark a headline as a todo item?
|
|
** Back
|
|
#+begin_src org
|
|
TODO Some task
|
|
DONE Completed task
|
|
#+end_src
|
|
|
|
Common states: =TODO=, =DONE=, =NEXT=, =WAITING=, =CANCELLED=
|
|
|
|
* Radio Targets
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
What is a radio target in org-mode?
|
|
** Back
|
|
Links that jump to specific locations in the same file:
|
|
#+begin_src org
|
|
<<target name>>
|
|
|
|
[[target name]] or [[*target name]]
|
|
#+end_src
|
|
|
|
* Statistics Cookies
|
|
:PROPERTIES:
|
|
:ANKI_NOTE_TYPE: Basic
|
|
:END:
|
|
** Front
|
|
How do you show task progress in org-mode?
|
|
** Back
|
|
#+begin_src org
|
|
[50%] - percentage
|
|
[3/5] - completed/total
|
|
#+end_src
|
|
|
|
Often used in lists like: =[- 2/5]=
|