settings:
show timestamps

Org-mode sandbox

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

CREATED: [2019-11-17 02:13]

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.

[2019-09-02 19:45] heading with tagstag1tag2

The sidenote will be displayed on the right

TODO[2019-09-02 19:46] private tags?

[2020-04-29 22:02] more sidenote testing…

Aside notes shouldn't overlap!

some long sentence some long sentence some long sentence some long sentence some long sentence some long sentence some long sentence some long sentence
more words

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

CREATED: [2020-02-27 10:15]

This would fail when executed. By default, Emacs simply swallows the errors.

import notexisting

TODO[2020-02-27 12:48] 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[2019-10-24 15:26] 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
  • File 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.

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' 

test.png