<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>notroot (Posts about blog)</title><link>https://blog.notroot.online/</link><description></description><atom:link href="https://blog.notroot.online/categories/blog.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2024 &lt;a href="mailto:notroot@notroot.online"&gt;Notroot&lt;/a&gt; </copyright><lastBuildDate>Sat, 18 May 2024 00:57:41 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Adding a Fediverse Share Button to my Emacs Nikola Blog</title><link>https://blog.notroot.online/posts/adding-a-fediverse-share-button-to-my-emacs-nikola-blog/</link><dc:creator>Notroot</dc:creator><description>&lt;p&gt;
I was browsing the Fediverse, as is my wont, and I came across a fella named Stefan Bohacek announcing the release of his new Fediverse Share Button. I tried it with my Sharkey instance and it worked! So I decided to add it to this blog. Even working with Nikola and Emacs, it was pretty frickin' easy.
&lt;/p&gt;

&lt;iframe src="https://stefanbohacek.online/@stefan/112456716124668605/embed" class="mastodon-embed" style="max-width: 100%; border: 0" width="400" allowfullscreen="allowfullscreen"&gt;&lt;/iframe&gt;&lt;script src="https://stefanbohacek.online/embed.js" async="async"&gt;&lt;/script&gt;

&lt;p&gt;
To continue my very meta habit of writing about blogging on my blog, here's how I added the share button at the bottom of this page.
&lt;/p&gt;

&lt;div id="outline-container-org6d755c7" class="outline-2"&gt;
&lt;h2 id="org6d755c7"&gt;Install Fediverse Share Button&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org6d755c7"&gt;
&lt;p&gt;
First, we simply need to clone the &lt;a href="https://github.com/stefanbohacek/fediverse-share-button/"&gt;fediverse-share-button&lt;/a&gt; repo. I cloned it next to my blog directory to make it a little simpler to move files into place, like this:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;cp -r ./fediverse-share-button/fediverse-share-button ./notroot-blog/files
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
That's it for now! Next, I'll show you how to incorporate those files into your Nikola builds.
&lt;/p&gt;

&lt;p&gt;
I referred to &lt;a href="https://randomgeekery.org/post/2020/01/tweaking-a-nikola-theme/"&gt;this "Random Geekery" blog post&lt;/a&gt; to figure out how to tweak Nikola themes and templates to include my fancy new share button.
&lt;/p&gt;

&lt;p&gt;
Boiling down my "learnings" (barf) for the reader, here's what I did.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org8a66f55" class="outline-2"&gt;
&lt;h2 id="org8a66f55"&gt;Create a New Theme to Tweak&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org8a66f55"&gt;
&lt;p&gt;
Rather than tweaking the installed theme – in my case, the &lt;code&gt;hack&lt;/code&gt; theme – we want to inherit from it, and make the changes to our own theme templates.
&lt;/p&gt;

&lt;p&gt;
First, I created a new theme called &lt;code&gt;notroot&lt;/code&gt;, based on &lt;code&gt;hack&lt;/code&gt;, like this:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;nikola theme --new notroot --parent hack
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Then, I changed my theme and disabled bundling in Nikola's &lt;code&gt;conf.py&lt;/code&gt;, like this:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;THEME&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"notroot"&lt;/span&gt;
&lt;span class="n"&gt;USE_BUNDLES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;False&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Then, I copied the post template into my new &lt;code&gt;notroot&lt;/code&gt; theme, like this:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;nikola theme --copy-template post.tmpl
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
To make sure my new &lt;code&gt;notroot&lt;/code&gt; theme was exactly the same as &lt;code&gt;hack&lt;/code&gt;, I did a quick built and served it locally, like this:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;nikola build
nikola serve
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Perfect! Nothing changed… yet.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-orgcd8e9be" class="outline-2"&gt;
&lt;h2 id="orgcd8e9be"&gt;Add Fediverse Share Button&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgcd8e9be"&gt;
&lt;p&gt;
Next, I opened the aforementioned &lt;code&gt;post.tmpl&lt;/code&gt; file in Emacs, and more or less followed Stefan's instructions. However, because we're working with a Nikola template (Mako), there was a little more to it.
&lt;/p&gt;

&lt;p&gt;
My &lt;code&gt;post.tmpl&lt;/code&gt; has a block called &lt;code&gt;extra_head&lt;/code&gt;, so that's where I added the CSS link. It should look sorta like this afterwards:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&amp;lt;%block name="extra_head"&amp;gt;
&amp;lt;!-- ... the rest of 'extra_head' ... --&amp;gt;
&amp;lt;link rel="stylesheet" href="/fediverse-share-button/styles.min.css"&amp;gt;
&amp;lt;/%block&amp;gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Note that, unlike Stefan's instructions, we use an absolute path here &lt;code&gt;/&lt;/code&gt;, not a relative path &lt;code&gt;./&lt;/code&gt;, to the &lt;code&gt;fediverse-share-button/&lt;/code&gt; directory. That's because Nikola will move things around when it builds, and because we just plopped &lt;code&gt;fediverse-share-button&lt;/code&gt; into the &lt;code&gt;files/&lt;/code&gt; directory, it will be at the top level, next to &lt;code&gt;assets/&lt;/code&gt; and &lt;code&gt;images/&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
To include the &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag pointing to the Javascript for our share button, I had to add an &lt;code&gt;extra_js&lt;/code&gt; block to the bottom of &lt;code&gt;post.tmpl&lt;/code&gt;. It also uses absolute paths, like this:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&amp;lt;%block name="extra_js"&amp;gt;
&amp;lt;script src="/fediverse-share-button/script.min.js" defer class="fsb-script"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/%block&amp;gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Then, finally, I was able to include the actual button &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; element. I chose the bottom of the post, above the navigation. The whole &lt;code&gt;content&lt;/code&gt; block, after my changes, looks like this (comments added for emphasis):
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&amp;lt;%block name="content"&amp;gt;
&amp;lt;article class="post-${post.meta('type')} h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"&amp;gt;
    ${pheader.html_post_header()}
    &amp;lt;div class="e-content entry-content" itemprop="articleBody text"&amp;gt;
    ${post.text()}
    &amp;lt;/div&amp;gt;
    &amp;lt;aside class="postpromonav"&amp;gt;

	&amp;lt;!-- START fediverse-share-button form --&amp;gt;

	&amp;lt;form class="fsb-prompt"&amp;gt;
	    &amp;lt;label&amp;gt;Share with the fediverse&amp;lt;/label&amp;gt;
	    &amp;lt;div class="fsb-input-group mb-3"&amp;gt;
		&amp;lt;span class="fsb-input-group-text"&amp;gt;https://&amp;lt;/span&amp;gt;
		&amp;lt;input required
		       type="text"
		       name="fediverse-domain"
		       placeholder="mastodon.social"
		       class="fsb-input fsb-domain"
		       aria-label="Amount (to the nearest dollar)"&amp;gt;
		&amp;lt;button class="fsb-button"
			type="submit"&amp;gt;&amp;lt;img src="/fediverse-share-button/icons/mastodon.svg"
					   class="fsb-icon"&amp;gt;&amp;lt;/span&amp;gt;Share&amp;lt;/button&amp;gt;
	    &amp;lt;/div&amp;gt;
	    &amp;lt;p class="fsb-support-note fsb-d-none"&amp;gt;
		This server does not support sharing. Please visit &amp;lt;a class="fsb-support-note-link"
								      target="_blank"
								      href=""&amp;gt;&amp;lt;/a&amp;gt;.
	    &amp;lt;/p&amp;gt;
	&amp;lt;/form&amp;gt;

	&amp;lt;!-- END form --&amp;gt;

    &amp;lt;nav&amp;gt;
    ${helper.html_tags(post)}
    ${helper.html_pager(post)}
    &amp;lt;/nav&amp;gt;
    &amp;lt;/aside&amp;gt;
    % if not post.meta('nocomments') and site_has_comments:
	&amp;lt;section id="comment-section" class="comments hidden-print"&amp;gt;
	&amp;lt;h2&amp;gt;${messages("Comments")}&amp;lt;/h2&amp;gt;
	${comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path)}
	&amp;lt;/section&amp;gt;
    % endif
    ${math.math_scripts_ifpost(post)}
&amp;lt;/article&amp;gt;
${comments.comment_link_script()}
&amp;lt;/%block&amp;gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Then, once again, I built it and served it locally to check my work.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org97a6e42" class="outline-2"&gt;
&lt;h2 id="org97a6e42"&gt;Style the Fediverse Share Button&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org97a6e42"&gt;
&lt;p&gt;
Success! Except…
&lt;/p&gt;

&lt;p&gt;
Except the CSS was all screwy. The share button itself was enormous, due to how &lt;code&gt;hack&lt;/code&gt; CSS treats all &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tags, and it was all left-justified, when my tags right below are centered.
&lt;/p&gt;

&lt;p&gt;
Let's fix that!
&lt;/p&gt;

&lt;p&gt;
It turned out to be dead simple. I inspected the classes in the browser, fixed it so it looked right, then copied those styles out of &lt;code&gt;files/fediverse-share-button/styles.css&lt;/code&gt; and into my own &lt;code&gt;files/assets/css/custom.css&lt;/code&gt; file. Then I added the attributes needed to fix things.
&lt;/p&gt;

&lt;p&gt;
To fix the enormous button, I just added &lt;code&gt;!important&lt;/code&gt; to &lt;code&gt;max-width&lt;/code&gt;:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;fsb-icon&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="k"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="kt"&gt;rem&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="cp"&gt;!important&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="k"&gt;margin-right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="kt"&gt;rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="k"&gt;vertical-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;baseline&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
To get the whole shebang centered, I modified &lt;code&gt;.fsb-prompt&lt;/code&gt; to add &lt;code&gt;auto&lt;/code&gt; margins on the right and left, which effectively centered the &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; itself. I also had the form center text. It looks like this, now:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;fsb-prompt&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="k"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="kt"&gt;px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="k"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;52&lt;/span&gt;&lt;span class="kt"&gt;px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="k"&gt;margin-left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="k"&gt;margin-right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="k"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
And voila! Beautiful!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org373783d" class="outline-2"&gt;
&lt;h2 id="org373783d"&gt;Build and Deploy&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org373783d"&gt;
&lt;p&gt;
Once I was satisfied with the look and functionality, I was ready for the final build and deployment.
&lt;/p&gt;

&lt;p&gt;
First, though, I needed to minify the CSS changes that I had made. Stefan describes this, as well – for both JS and CSS – but here's exactly what I did:
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;npm install minify -g
minify files/fediverse-share-button/styles.css &amp;gt; files/fediverse-share-button/styles.min.css
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Finally I was ready to build and deploy, as usual, from within Emacs.
&lt;/p&gt;

&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;code&gt;M-x nikola-build&lt;/code&gt; to build.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;M-! nikola deploy&lt;/code&gt; to deploy.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-orgbe71453" class="outline-2"&gt;
&lt;h2 id="orgbe71453"&gt;Next Steps&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-orgbe71453"&gt;
&lt;p&gt;
Next steps are three-fold:
&lt;/p&gt;

&lt;ol class="org-ol"&gt;
&lt;li&gt;Publish &lt;b&gt;this blog post&lt;/b&gt; to my blog.&lt;/li&gt;

&lt;li&gt;Once published, I will click the Fediverse Share Button and share to my Fediverse account.&lt;/li&gt;

&lt;li&gt;Then I will get the article ID of that Fediverse note, and add it to the meta for this post. Then I'll rebuild and redeploy. This will enable the "Comments" section, and replies to my Fediverse note will appear as comments on this blog post!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
It's like frickin' magic, baby!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</description><category>blog</category><category>emacs</category><category>fediverse</category><category>nikola</category><category>social</category><guid>https://blog.notroot.online/posts/adding-a-fediverse-share-button-to-my-emacs-nikola-blog/</guid><pubDate>Fri, 17 May 2024 19:46:34 GMT</pubDate></item><item><title>Blogging with Emacs: Plots and Diagrams</title><link>https://blog.notroot.online/posts/blogging-with-emacs%3A-bells-and-whistles/</link><dc:creator>Notroot</dc:creator><description>&lt;p&gt;
Continuing my very-meta habit of blogging about how I'm blogging, and not much else… I give you: "Bells and Whistles," perhaps better titled, "More of the Same".
&lt;/p&gt;

&lt;p&gt;
In Emacs Org Mode, there are many ways to plot and diagram, and even draw (it's terrible, don't bother). Let's see if we can get some working with my Nikola-based blogging solution.
&lt;/p&gt;

&lt;div id="outline-container-org7b74ec5" class="outline-2"&gt;
&lt;h2 id="org7b74ec5"&gt;Plotting Charts&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org7b74ec5"&gt;
&lt;p&gt;
This example is from Org Mode's &lt;a href="https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html"&gt;official documentation&lt;/a&gt;, though I've changed the output path for Nikola building.
&lt;/p&gt;

&lt;p&gt;
First I'll activate a Python &lt;code&gt;venv&lt;/code&gt; with &lt;code&gt;matplotlib&lt;/code&gt; pre-installed
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;matplotlib&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nn"&gt;plt&lt;/span&gt;
&lt;span class="n"&gt;fig&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;figure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;figsize&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;plot&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="n"&gt;fig&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tight_layout&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;fname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'../images/myfig.png'&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;savefig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fname&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# fname[1:] # return this to org-mode&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Then make an HTML link (on Org export) into &lt;code&gt;images&lt;/code&gt;, like this:
&lt;/p&gt;

&lt;pre class="example" id="org6e44a8d"&gt;
[[./images/myfig.png]]
&lt;/pre&gt;

&lt;p&gt;
Which will then display the image after Nikola builds, like this:
&lt;/p&gt;


&lt;div id="orge7df8ab" class="figure"&gt;
&lt;p&gt;&lt;img src="https://blog.notroot.online/images/myfig.png" alt="nil"&gt;
&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
Voila! We plotted a chart! If I change the Python code, and re-build, I'll get a different chart.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org3826789" class="outline-2"&gt;
&lt;h2 id="org3826789"&gt;Diagramming&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org3826789"&gt;
&lt;p&gt;
Diagrams are different from plots and charts. They aren't strictly mathematical. Instead, we need to look to other possible solutions.
&lt;/p&gt;

&lt;p&gt;
Emacs package sources offer several options, but the one I have experience with is &lt;a href="https://ditaa.sourceforge.net/"&gt;ditaa&lt;/a&gt;.
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;+--------+   +-------+    +-------+
|        | --+ ditaa +--&amp;gt; |       |
|  Text  |   +-------+    |diagram|
|Document|   |!magic!|    |       |
|     {d}|   |       |    |       |
+---+----+   +-------+    +-------+
    :                         ^
    |       Lots of work      |
    +-------------------------+
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;
Then make an HTML link like before:
&lt;/p&gt;


&lt;div id="org32f77ab" class="figure"&gt;
&lt;p&gt;&lt;img src="https://blog.notroot.online/images/ditaa.png" alt="nil"&gt;
&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;
Voila! We made a diagram!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="outline-container-org1b5ad41" class="outline-2"&gt;
&lt;h2 id="org1b5ad41"&gt;Conclusion&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-org1b5ad41"&gt;
&lt;p&gt;
I also tried including LaTeX equations and inline LaTeX, to no avail. Even with the default MathJax, it seems that Nikola does not do a pure Emacs Org Mode export to HTML, and I was unable to get LaTeX working.
&lt;/p&gt;

&lt;p&gt;
Which brings up the point I'd like to conclude with:
&lt;/p&gt;

&lt;p&gt;
Nikola + Org Mode is a workable solution that lets us use most Org Mode features out-of-the-box, like tables, executable code blocks, and the like.
&lt;/p&gt;

&lt;p&gt;
However, when it comes to bells and whistles, it falls a little short of pure Org Mode HTML export.
&lt;/p&gt;

&lt;ul class="org-ul"&gt;
&lt;li&gt;Having to create a separate HTML link for an image is annoying, but Nikola makes so much else easier that I can probably overlook it. If I was doing a pure Org Mode export, Emacs would create the image link for me.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;ditaa&lt;/code&gt; integration was awkward, at best. I basically had to do an Org Mode HTML export to the &lt;code&gt;../images&lt;/code&gt; directory, then add an HTML link. If it was pure Org Mode export, Emacs would create the image link for me.&lt;/li&gt;
&lt;li&gt;No Emacs-based LaTeX. In fact, I couldn't get LaTeX to display at all! Even after I added the &lt;code&gt;mathjax&lt;/code&gt; tag to the post's meta file, as described in the Nikola Handbook.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
For now, I'll keep using Nikola, but my next iteration of this blog might be pure Org Mode, with HTML templates.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;</description><category>blog</category><category>diagrams</category><category>emacs</category><category>org-mode</category><category>plots</category><guid>https://blog.notroot.online/posts/blogging-with-emacs%3A-bells-and-whistles/</guid><pubDate>Wed, 01 May 2024 00:39:09 GMT</pubDate></item><item><title>Blog Upgrade</title><link>https://blog.notroot.online/posts/blog-upgrade/</link><dc:creator>Notroot</dc:creator><description>&lt;p&gt;
I'm an engineer, and I'm an Emacs nut, so yes: I tinker a lot.
&lt;/p&gt;

&lt;p&gt;
My latest tinkering was to move my Nikola- and Emacs-based blog out of GitHub, when I abandoned that service entirely, and moved all my code to GitLab.
&lt;/p&gt;

&lt;p&gt;
My reasons for moving are pretty straightforward: I think the "AI" hype is bullshit, and I won't have anything to do with it. I certainly don't want Micro$oft training their "AI" LLMs on my code. Fuck our robot overlords. They can meet me in the street and we can fight it out.
&lt;/p&gt;

&lt;p&gt;
GitLab also has "AI" features, but nothing like GitHub. What's more, I can host my own GitLab and eschew their "AI" fuckstickery, entirely. Can't do that with GitHub, so it was an easy calculus to perform.
&lt;/p&gt;

&lt;p&gt;
I did try to use GitLab Pages, which is really part of GitLab CI, which is to say, "Pipelines".
&lt;/p&gt;

&lt;p&gt;
Overkill, yo. Too much configuration-over-convention for my taste. I don't like Python Django, either, for the same reason. If I'm doing web work, gimme Flask any day of the week.
&lt;/p&gt;

&lt;p&gt;
Anyhow, while I was moving my blog, I thought I'd give it a new look. No more white background, and no more left-aligned container &lt;code&gt;div&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
Still not much here on this pathetic blog, but maybe now that I can write and easily deploy to my own host, I'll actually blog a little more.
&lt;/p&gt;

&lt;p&gt;
I might even write about something besides Emacs!
&lt;/p&gt;

&lt;p&gt;
Ya never know…
&lt;/p&gt;</description><category>blog</category><category>emacs</category><category>github</category><category>gitlab</category><category>nikola</category><category>org-mode</category><guid>https://blog.notroot.online/posts/blog-upgrade/</guid><pubDate>Sat, 06 Apr 2024 21:38:32 GMT</pubDate></item></channel></rss>