Org Mode
Home |
Table of Contents
https://orgmode.org/manual/index.html#SEC_Contents
MY PROJECTS -*- mode: org; -*-
* Top level headline ** Second level *** Third level some text *** Third level more text * Another top level headline
,-> FOLDED -> CHILDREN -> SUBTREE --. '-----------------------------------'
Plain Lists
* Lord of the Rings My favorite scenes are (in this order) 1. The attack of the Rohirrim 2. Eowyn's fight with the witch king + this was already my favorite scene in the book + I really like Miranda Otto. 3. Peter Jackson being shot by Legolas - on DVD only He makes a really funny face when it happens. But in the end, no individual scenes matter but the film as a whole. Important actors in this film are: - Elijah Wood :: He plays Frodo - Sean Astin :: He plays Sam, Frodo's friend. I still remember him very well from his role as Mikey Walsh in /The Goonies/.
Literal Examples
(defun org-xor (a b) "Exclusive or." (if a (not b) b))
Emacs Org-mode is a powerful tool for taking notes and easily exporting them to various formats, including HTML. Here's a step-by-step guide on how to use Org-mode for note-taking and publishing in HTML:
1 Set Up Org-mode in Emacs
Org-mode is often bundled with Emacs, but you can activate it by adding the following to your Emacs config (.emacs or init.el):
(require 'org)
2 Taking Notes with Org-mode
To start taking notes, open a new file with an .org extension:
C-x C-f mynotes.org
You can structure your notes using headers (* for top-level headings, ** for sub-headings, etc.) and basic Org syntax:
* Top-level header This is some content under the top-level header. ** Sub-heading This is a note under the sub-heading. - Bullet point 1 - Bullet point 2
You can add emphasis using:
italic with /text/ bold with *text* code with =text=
3 Exporting to HTML
Org-mode allows easy export to HTML with built-in functions. To export your file to HTML, use:
C-c C-e h h
This will generate an HTML file from your Org file. The C-c C-e command brings up the export menu, and the h h sequence specifies HTML export.
You can also customize the export settings, such as including a table of contents, setting up CSS, or adding custom HTML by configuring your .emacs file:
(setq org-html-head "<link rel=\"stylesheet\" type=\"text/css\" href=\"mystyle.css\" />") (setq org-html-postamble nil) ;; Remove footer
4 Publishing Multiple Files
If you have several Org files and want to publish them as a website, Org-mode’s publishing system can help. Define a publishing project in your .emacs file:
(setq org-publish-project-alist '(("notes" :base-directory "~/org/" :base-extension "org" :publishing-directory "~/public_html/" :recursive t :publishing-function org-html-publish-to-html :headline-levels 4 :auto-preamble t)))
This will publish all Org files in ~/org/ to HTML files in ~/public_html/.
5 Adding Metadata
You can include metadata like the title, author, or date by adding these lines at the top of your Org file:
#+TITLE: My Notes #+AUTHOR: My Name #+DATE: 2024-09-06
6 Advanced Features
Source Code Blocks: Org-mode can handle code snippets and syntax highlighting for programming languages. Use the following syntax:
#+BEGIN_SRC python print("Hello, World!") #+END_SRC
print("Hello, World!")
Tables: You can also create tables in Org-mode, which export cleanly to HTML:
| Name | Age | |--------|-----| | Alice | 30 | | Bob | 25 |
By combining these features, you can create rich, structured notes that can easily be published to HTML.