in which i develop courage
After some consideration, I think that I can keep this in public. It's going to take me a few days before I can post it, anyway, and I'll have some amount of time to build up the posting habit. Making a low-effort tool for writing from the phone will still be a challenge. But I want to move my goal from "write every day" to "write every day in public," even if I'm not expecting to have an audience.
It occurs to me that lots of this musing might have gone into my perhaps-someday-a-reference about nikola. But right now I'm figuring things out, and I suppose that should be more declarative than interrogative.
Site maps
Let's have a look around. I see from the nikola
output that there's
a set make that gets made. Where is that stored? Looks like there
are /sitemap.xml
and
/sitemapindex.xml
. And they do in fact list
every item in the site, including all of the pages. So I shouldn't
expect any of those things to be private, even if I don't explicitly
link them anywhere else.
Math support
Let's try to turn on MathJax. The Einstein equation of motion for a
massive particle is \(E^2 = p^2 + m^2 = {m^2}/{\sqrt{1-v^2}}\),
using units where the speed of light is \(c=1\). It's the "new"
LaTeX math delimiter \\(
and \\)
, now that the dollar signs are
deprecated. However, the display-mode can be activated with $$
as
well as \\[
and \\]
:
\[ e^{i\theta} = \cos\theta + i\sin\theta, \]
but also
\[ \frac1\mu = \frac1m + \frac1M.\]
I think that I'm going to enable KaTeX rather
that MathJax. In either case I need to
have has_math: true
in the metadata for the page source.
Code and plotting support
Next I want to experiment with Python a little bit. I understand that
I can use some amount of Python code inline? Or there's plotting? I
know that there is some support for Jupyter notebooks as web pages.
Let's have a look at that. Here's the right part of the
documentation,
though that link doesn't look like it'll last forever, since the
#anchor
ends in a number.
I knew already that I could do in-line code, like
def hello(name="world"): print(f"Hello, {name}!") if __name__ == "__main__": hello("everybody")
There is syntax for code listings, but it looks like reStructured Text syntax. Perhaps it will work anyway?
.. listing:: auto/in-which-i-develop-courage/foo.py python
Nope, that's broken. That's an .rst
-only syntax.
Update: See the long and the shortcodes of it:
auto/in-which-i-develop-courage/foo.py (Source)
class Foo: def __init__(self, bar): self.bar = bar if __name__ == "__main__": foo = Foo('baz') print(f'{foo.bar=}')
Links and images
And a cute thing to have discovered: links are relative to the
directory that this post is in, so I can just add files there.
Keeps things organized. Does that mean I can organize stuff, like this
self-portrait? It doesn't seem to. Instead I had to add this to
/files
(although I made /files/images
).
That image comes out huge! I didn't realize it was a 1000x1000 pixel image. And I can't resize it manually. Of course the right way is to make an image that has the size and resolution I want, using some image editor. But I can also include HTML directly:
That's the time I have for this morning. But: useful!