Org-mode sandbox
Table of Contents
Here I'm demonstrating/testing various settings and tweaks I've got for org-mode exports.
¶regular heading
If you hover over a child, you'd see dashed line to the left that outlines the span.
¶regular child 1
types of fusion
- Thermonuclear fusion
- Inertial confinement fusion
- Inertial electrostatic confinement
- Beam-beam or beam-target fusion
¶regular child 2
Nuclear fission of heavy elements was discovered on December 17, 1938 by German Otto Hahn and his assistant Fritz Strassmann, and explained theoretically in January 1939 by Lise Meitner and her nephew Otto Robert Frisch. Frisch named the process by analogy with biological fission of living cells. For heavy nuclides, it is an exothermic reaction which can release large amounts of energy both as electromagnetic radiation and as kinetic energy of the fragments (heating the bulk material where fission takes place). In order for fission to produce energy, the total binding energy of the resulting elements must be more negative (greater binding energy) than that of the starting element.
¶heading with CREATED timestamp
¶intrapage link to a future heading
That way you know you'd encounter linked item later on the page if you just keep reading.
Perhaps that's better to handle this via browser extension, then it'd work on all pages.
¶ heading with tagstag1tag2
¶TODO private tags?
¶ more sidenote testing…
Aside notes shouldn't overlap!
¶testing tags aside plain list
- eins
- zwei
- drei
¶code exports (org-babel)
¶python
This is a code block:
a = "whatever"
Separate code block, but they are sharing a 'session', so the following block has access to a
.
print(a)
whatever
¶proper error handling in code exports
This would fail when executed. By default, Emacs simply swallows the errors.
import notexisting
¶TODO need to add defensive policy to display errors in the result
¶Custom language (mypy as an example)
Custom mypy executor that runs both code and mypy
def whatever(s: str) -> int: return s + 1
Mypy output [exit code 1]: input.py: note: In function "whatever": input.py:2: error: Returning Any from function declared to return "int" [no-any-return] return s + 1 ^ input.py:2: error: Unsupported operand types for + ("str" and "int") [operator] return s + 1 ^ Found 2 errors in 1 file (checked 1 source file)
¶TODO eh, need to implement proper eval for it somehow..
¶modifying Babel execution context
Set variables in Elisp code (remember to use :exports both
):
;; perhaps more useful: (setenv "PATH" (concat "WHATEVER" ":" (getenv "PATH")))) (setenv "BABEL" "yes")
yes
Use them in the code blocks in the rest of the document:
import os print("Babel? ", os.environ['BABEL'])
Babel? yes
¶links
-
These are really nice, because:
- when you edit org-mode, you see [[file:../myinfra.org][File links]], so you can jump straight to the file, etc
- during HTML export, the link resolves to relative HTML link
For more info see org-mode docs on Hyperlinks
- intrapage link to a past heading
internal Org link, within the document, can be inserted anywhere in org file
Note that I got a fix so internal links end up with meaningful names.
By default, they are some sort of arbitrary hashes.
link icons (inspired by Gwern)
Should be a browser extension, to be honest.
target for internal org link (see here)
¶spacing between items
¶xxxx
- one
- twoo
thrreee
and some text
¶TODO[C]mention why it's necessary; there was smth wrong with default
¶different kinds of inline code
this_is_code()
and /this/is/verbatim
¶table
id | url_id | visit_time |
… | … | … |
300 | 100 | 2011-02-10 10:00 |
… | … | … |
498 | 100 | 2011-04-01 09:00 |
499 | 200 | 2011-04-02 05:00 |
… | … | … |
900 | 100 | 2012-06-03 12:00 |
After that, you can reference this table.
Again, compile-org.el
is using some custom code for meaningful ids.
¶plot
import matplotlib, numpy matplotlib.use('Agg') import matplotlib.pyplot as plt fig = plt.figure(figsize=(6, 2)) x = numpy.linspace(-10, 10) plt.plot(numpy.sin(x)) fig.tight_layout() plt.savefig('test.png') return 'test.png'