<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Hugo on Clément Joly – Open-Source, Rust &amp; SQLite</title><link>https://cj.rs/tags/hugo/</link><description>Recent content in Hugo on Clément Joly – Open-Source, Rust &amp; SQLite</description><image><title>Clément Joly – Open-Source, Rust &amp; SQLite</title><url>https://cj.rs/images/open-graph-pages.jpg</url><link>https://cj.rs/images/open-graph-pages.jpg</link></image><generator>Hugo</generator><language>en</language><copyright>Clément Joly</copyright><lastBuildDate>Thu, 28 May 2026 23:48:29 +0000</lastBuildDate><atom:link href="https://cj.rs/tags/hugo/index.xml" rel="self" type="application/rss+xml"/><item><title>New Asciinema Hugo Module Versions</title><link>https://cj.rs/blog/new-asciinema-hugo-module-versions/</link><pubDate>Thu, 07 Mar 2024 07:35:45 +0000</pubDate><guid>https://cj.rs/blog/new-asciinema-hugo-module-versions/</guid><description>&lt;p&gt;I’ve just added the last 8 versions of the &lt;a href="https://github.com/asciinema/asciinema-player/"&gt;Asciinema player&lt;/a&gt; to &lt;a href="https://cj.rs/gohugo-asciinema/"&gt;gohugo-asciinema&lt;/a&gt;, my &lt;a href="https://gohugo.io/"&gt;Hugo&lt;/a&gt; module to easily integrate the Asciinema player to your website.
Lots of exciting new features, like improved decoding and rendering efficiency as well as some support for streaming asciicasts.
See the &lt;a href="#changelogs"&gt;changelog links below&lt;/a&gt; for details of the changes.
There were no changes made to the Hugo module itself, besides copying the JS &amp;amp; CSS from the Asciinema player.&lt;/p&gt;</description><content:encoded><![CDATA[<p>I’ve just added the last 8 versions of the <a href="https://github.com/asciinema/asciinema-player/">Asciinema player</a> to <a href="/gohugo-asciinema/">gohugo-asciinema</a>, my <a href="https://gohugo.io/">Hugo</a> module to easily integrate the Asciinema player to your website.
Lots of exciting new features, like improved decoding and rendering efficiency as well as some support for streaming asciicasts.
See the <a href="#changelogs">changelog links below</a> for details of the changes.
There were no changes made to the Hugo module itself, besides copying the JS &amp; CSS from the Asciinema player.</p>
<p>Security note: all the releases are <a href="/open-source/docs/security/">signed</a>.
You can even check that the files JS and CSS file in the plugin match the ones uploaded in release pages.
Thanks to <a href="https://github.com/ku1ik">@ku1ik</a> for providing these files directly!</p>
<h2 id="updating-in-hugo">Updating in Hugo</h2>
<p>As usual to get the latest version the player on your website, you can run:</p>
<pre tabindex="0"><code>hugo mod get -u cj.rs/gohugo-asciinema
</code></pre><h2 id="changelogs">Changelogs</h2>
<p>Here is the changelogs in the upstream Asciinema player for the updated versions:</p>
<ul>
<li><a href="https://github.com/asciinema/asciinema-player/releases/tag/v3.7.0">3.7.0</a></li>
<li><a href="https://github.com/asciinema/asciinema-player/releases/tag/v3.6.4">3.6.4</a></li>
<li><a href="https://github.com/asciinema/asciinema-player/releases/tag/v3.6.3">3.6.3</a></li>
<li><a href="https://github.com/asciinema/asciinema-player/releases/tag/v3.6.2">3.6.2</a></li>
<li><a href="https://github.com/asciinema/asciinema-player/releases/tag/v3.6.1">3.6.1</a></li>
<li><a href="https://github.com/asciinema/asciinema-player/releases/tag/v3.5.0">3.5.0</a></li>
<li><a href="https://github.com/asciinema/asciinema-player/releases/tag/v3.4.0">3.4.0</a></li>
<li><a href="https://github.com/asciinema/asciinema-player/releases/tag/v3.3.0">3.3.0</a></li>
</ul>
<h2 id="delay-updating-the-css-and-js-files">Delay Updating the CSS and JS Files</h2>
<p>I apologize for the delay in updating those versions in my Hugo module.
I do have alerts set up when a new version comes in but I’m still testing manually to make sure that the updated version works well.
This Hugo module being a side-project, I did not get the chance to do the testing any earlier.
I’ve tested all those versions against various pages of my website, and it all worked well.
But please feel free to <a href="https://github.com/cljoly/gohugo-asciinema/issues/new/choose">report</a> any problem you may encounter.</p>
<p>Moving forward, I’ll rely <a href="https://github.com/cljoly/gohugo-asciinema/blob/abb45e1c71409f195ab1d25d20bd548f12291e0c/update.fish">on a script</a> to automate the bulk of the update, that should help updating only a few days after the release.
That script is not perfect and will be improved incrementally.</p>
<p>Since this is a release related to Asciinema, here is an asciicast of that new script downloading the latest CSS and JS, making a commit and tagging it.</p>
<div id="demo3"></div>
<script>
AsciinemaPlayer.create("./update.json", document.getElementById('demo3'), {
"poster": "npt:0:05",
});
</script>
<noscript><blockquote><p>To run this asciicast without javascript, use <code>asciinema play https://cj.rs/update.json</code> with <a href="https://asciinema.org/">Asciinema</a></p></blockquote></noscript>

<p>Please feel free to use this script and open a PR if you spot an update before I do in the future 😁.</p>
]]></content:encoded></item><item><title>GoHugo Asciinema</title><link>https://cj.rs/gohugo-asciinema/</link><pubDate>Sat, 21 Aug 2021 16:25:33 +0100</pubDate><guid>https://cj.rs/gohugo-asciinema/</guid><description>⏯️ Insert the Asciinema Player in your Hugo site with ease.</description><content:encoded><![CDATA[
<p style="display: flex; justify-content: space-between">
  <a href="https://github.com/cljoly/gohugo-asciinema" data-goatcounter-click="ext-github-gohugo-asciinema" data-goatcounter-title="cljoly/gohugo-asciinema">
    <span class="svgicon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
    stroke-linecap="round" stroke-linejoin="round">
    <path
        d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22">
    </path>
</svg></span>&nbsp;cljoly/gohugo-asciinema
  </a>
  <a class="badges" href="https://github.com/cljoly/gohugo-asciinema" data-goatcounter-click="ext-stargithub-gohugo-asciinema" data-goatcounter-title="stars cljoly/gohugo-asciinema">
    <img src="https://img.shields.io/github/stars/cljoly/gohugo-asciinema?style=social" alt="Github stars for gohugo-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3JtPSJzY2FsZSguMSkiIGZpbGw9IiNmZmYiIHRleHRMZW5ndGg9IjQ5MCI+d2l0aCBSU1M8L3RleHQ+PC9nPjwvc3ZnPg=="></a>
<a href="https://github.com/cljoly/gohugo-asciinema/tags/">
<img alt="Asciinema Player Version" loading="lazy" src="https://img.shields.io/github/v/tag/cljoly/gohugo-asciinema?label=asciinema%20player%20version&logo=asciinema"></a>
<a href="https://cj.rs/riss">

  <img alt="Powered by RISS (cj.rs/riss)" loading="lazy" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDQiIGhlaWdodD0iMjAiIHJvbGU9ImltZyIgYXJpYS1sYWJlbD0icG93ZXJlZCBieTogcmlzcyI+PHRpdGxlPnBvd2VyZWQgYnk6IHJpc3M8L3RpdGxlPjxmaWx0ZXIgaWQ9ImJsdXIiPjxmZUdhdXNzaWFuQmx1ciBpbj0iU291cmNlR3JhcGhpYyIgc3RkRGV2aWF0aW9uPSIxNiIvPjwvZmlsdGVyPjxsaW5lYXJHcmFkaWVudCBpZD0icyIgeDI9IjAiIHkyPSIxMDAlIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiNiYmIiIHN0b3Atb3BhY2l0eT0iLjEiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3Atb3BhY2l0eT0iLjEiLz48L2xpbmVhckdyYWRpZW50PjxjbGlwUGF0aCBpZD0iciI+PHJlY3Qgd2lkdGg9IjEwNCIgaGVpZ2h0PSIyMCIgcng9IjMiIGZpbGw9IiNmZmYiLz48L2NsaXBQYXRoPjxnIGNsaXAtcGF0aD0idXJsKCNyKSI+PHJlY3Qgd2lkdGg9Ijc1IiBoZWlnaHQ9IjIwIiBmaWxsPSIjNTU1Ii8+PHJlY3QgeD0iNzUiIHdpZHRoPSIyOSIgaGVpZ2h0PSIyMCIgZmlsbD0iIzkzOTM5MyIvPjxyZWN0IHdpZHRoPSIxM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bGUoLjEpIiB0ZXh0TGVuZ3RoPSIxOTAiPnJpc3M8L3RleHQ+PHRleHQgeD0iODg1IiB5PSIxNDAiIHRyYW5zZm9ybT0ic2NhbGUoLjEpIiBmaWxsPSIjZmZmIiB0ZXh0TGVuZ3RoPSIxOTAiPnJpc3M8L3RleHQ+PC9nPjwvc3ZnPg=="></a></p>

</div>

<p>Want to insert a short demo of your tool or of a command execution on your website?
You could insert a video, but then visitors can’t copy text, and it’ll make your page quite heavy.
The <a href="https://github.com/asciinema/asciinema-player">Asciinema player</a> solves all of that, by replaying a terminal session stored in a text file.</p>
<p>This Hugo module makes it very easy to use the Asciinema Player on your Hugo-powered static website.</p>
<h2 id="install">Install</h2>
<h3 id="hugo-module">Hugo Module</h3>
<ol>
<li>
<p>Make sure the <a href="https://go.dev">go compiler</a> is installed as well as <a href="https://gohugo.io">Hugo</a>.
To check that, run the commands below. If the programs are installed, they should not return an error. Otherwise, see the <a href="https://go.dev/doc/install">go install instructions</a> and <a href="https://gohugo.io/getting-started/quick-start/">Hugo install instructions</a>:</p>
<pre tabindex="0"><code>go version
</code></pre><pre tabindex="0"><code>hugo version
</code></pre></li>
<li>
<p>If you haven’t already, you need to initialize Hugo modules:</p>
<pre tabindex="0"><code>hugo mod init example.com/my-awesome-website
</code></pre><p>This needs to be done once per Hugo site.
Read the <a href="https://gohugo.io/hugo-modules/use-modules/">Hugo documentation</a> for details and background.</p>
</li>
</ol>
<h3 id="install-this-module">Install This Module</h3>
<p>Once Hugo modules are set up (see the <a href="#hugo-module">previous section</a>), you can install the asciinema module itself.</p>
<ol>
<li>
<p>Run:</p>
<pre tabindex="0"><code>hugo mod get -u -v cj.rs/gohugo-asciinema
</code></pre></li>
<li>
<p>Edit your Hugo config to add the module reference.</p>
<p>For instance, if you use a <code>config.toml</code> config file, add:</p>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-toml" data-lang="toml"><span style="display:flex;"><span>[<span style="color:#e06c75">module</span>]
</span></span><span style="display:flex;"><span>[[<span style="color:#e06c75">module</span>.<span style="color:#e06c75">imports</span>]]
</span></span><span style="display:flex;"><span><span style="color:#e06c75">path</span> = <span style="color:#98c379">&#34;cj.rs/gohugo-asciinema&#34;</span>
</span></span></code></pre></div><p>For <code>config.yml</code>, add:</p>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#e06c75">module</span>:
</span></span><span style="display:flex;"><span><span style="color:#e06c75">imports</span>:
</span></span><span style="display:flex;"><span>    - <span style="color:#e06c75">path</span>: cj.rs/gohugo-asciinema
</span></span></code></pre></div></li>
</ol>
<h2 id="use">Use</h2>
<p>Use this <a href="https://gohugo.io/content-management/shortcodes/">shortcode</a>:</p>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-md" data-lang="md"><span style="display:flex;"><span>{{&lt; asciicast src=&#34;https://cj.rs/blog/cargo-info-in-neovim/demo.json&#34; poster=&#34;npt:0:04&#34; autoPlay=true loop=true &gt;}}
</span></span></code></pre></div><p>It&rsquo;s rendered like this:
<div id="demo3"></div>
<script>
AsciinemaPlayer.create("/blog/cargo-info-in-neovim/demo.json", document.getElementById('demo3'), {
"autoPlay":  true ,"loop":  true ,"poster": "npt:0:04",
});
</script>
<noscript><blockquote><p>To run this asciicast without javascript, use <code>asciinema play https://cj.rs/blog/cargo-info-in-neovim/demo.json</code> with <a href="https://asciinema.org/">Asciinema</a></p></blockquote></noscript>
</p>
<h3 id="defaults">Defaults</h3>
<p>You can set default values for the player in your <code>config.toml</code> or <code>params.toml</code> etc.. For example:</p>
<h4 id="configtoml"><code>config.toml</code></h4>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-toml" data-lang="toml"><span style="display:flex;"><span>[<span style="color:#e06c75">params</span>.<span style="color:#e06c75">asciinema</span>.<span style="color:#e06c75">defaults</span>]
</span></span><span style="display:flex;"><span><span style="color:#e06c75">theme</span> = <span style="color:#98c379">&#34;solarized-dark&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">loop</span> = <span style="color:#e5c07b">true</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">autoPlay</span> = <span style="color:#e5c07b">true</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">speed</span> = <span style="color:#d19a66">5.0</span>
</span></span></code></pre></div><h4 id="paramstoml"><code>params.toml</code></h4>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-toml" data-lang="toml"><span style="display:flex;"><span>[<span style="color:#e06c75">asciinema</span>.<span style="color:#e06c75">defaults</span>]
</span></span><span style="display:flex;"><span><span style="color:#e06c75">theme</span> = <span style="color:#98c379">&#34;solarized-dark&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">loop</span> = <span style="color:#e5c07b">true</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">autoPlay</span> = <span style="color:#e5c07b">true</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">speed</span> = <span style="color:#d19a66">5.0</span>
</span></span></code></pre></div><h3 id="notes">Notes</h3>




  
  
  
  

  <div class="alert alert-note">
    <p class="alert-heading">
      ℹ️
      
        Note
      
    </p>
    <p><code>src</code> is the only required argument. All the other arguments are parameters in the object passed as the third argument of <a href="https://docs.asciinema.org/manual/player/quick-start/#basic-usage"><code>AsciinemaPlayer.create</code></a>.</p>
  </div>







  
  
  
  

  <div class="alert alert-warning">
    <p class="alert-heading">
      ⚠️
      
        Warning
      
    </p>
    <p><code>src</code> is known to sometimes cause problem with relative URLs. Your best bet is to use absolute URLs or at least from the root of the site, as in the above example.</p>
  </div>







  
  
  
  

  <div class="alert alert-important">
    <p class="alert-heading">
      🟣
      
        Important
      
    </p>
    <p>Numbers and booleans should be passed <strong>without</strong> being enclosed in <code>&quot;</code>, i.e. <code>autoPlay=true</code>, <em>not</em> <code>autoPlay=&quot;true&quot;</code>.</p>
  </div>



<h3 id="advanced-features">Advanced Features</h3>
<h4 id="preloading">Preloading</h4>
<p>If you want to instruct the browser to <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload">preload</a> the CSS and JS of the Asciinema Player, only when the page contains an asciicast, you can add the following line in the <code>&lt;head&gt;</code> tag of your template:</p>
<pre tabindex="0"><code>{{- partial &#34;asciinema_css_js_smart_preload&#34; . -}}
</code></pre><p>Themes often offer ways to do this easily.
For instance with <a href="https://github.com/adityatelange/hugo-PaperMod/">Hugo PaperMod</a>, it’s in <a href="https://github.com/adityatelange/hugo-PaperMod/blob/b5f7118d826e663bfe76f56eba2baa028a384325/layouts/partials/extend_head.html">this file</a>.</p>
<p>This partial will also cause <a href="https://developers.cloudflare.com/pages/configuration/early-hints/">some services</a> to send <a href="https://developers.cloudflare.com/pages/platform/early-hints/">Early Hints</a>.
That can further improve the page load time.</p>
<h2 id="features">Features</h2>
<ul>
<li>Displays a message when JavaScript is disabled in the user browser</li>
<li>Fingerprinted assets, to improve caching and ultimately your site performance</li>
<li>Optional <a href="#preloading">preloading</a> of JS and CSS assets</li>
<li>Easy update with <code>hugo mod get -u cj.rs/gohugo-asciinema</code></li>
</ul>
<h2 id="how-are-the-sources-of-the-player-generated">How Are the Sources of the Player Generated?</h2>
<p>The Asciinema Player version is fetched from the official repository in the corresponding version.
Then, if prebuilt JS/CSS files are provided they are used, so that you can verify that this module is actually distributing the original code.
If not, these files are generated following the instructions from Asciinema Player Readme.</p>
<h2 id="contribute">Contribute</h2>
<p>Contributions (documentation or code improvements in particular) are welcome, see <a href="https://cj.rs/docs/contribute/">contributing</a>!</p>
<p>To test your code changes locally, you can change your configuration so that your local version is loaded.
Here is an example in TOML:</p>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-toml" data-lang="toml"><span style="display:flex;"><span>[<span style="color:#e06c75">module</span>]
</span></span><span style="display:flex;"><span><span style="color:#e06c75">replacements</span> = <span style="color:#98c379">&#34;cj.rs/gohugo-asciinema -&gt; /some/path/gohugo-asciinema&#34;</span>
</span></span><span style="display:flex;"><span>[[<span style="color:#e06c75">module</span>.<span style="color:#e06c75">imports</span>]]
</span></span><span style="display:flex;"><span><span style="color:#e06c75">path</span> = <span style="color:#98c379">&#34;cj.rs/gohugo-asciinema&#34;</span>
</span></span></code></pre></div><p>Please consider sending a PR with your patches, it’s always appreciated and will save you the trouble of maintaining the changes on your own!</p>
<h3 id="license">License</h3>
<p>The code of this module (everything but the folder <code>assets</code>) is under the <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a>, like the asciinema player itself.</p>
<p>The <code>assets</code> folder contains the asciinema player. This code is Copyright Marcin Kulik, licensed under the <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>. See the <a href="https://github.com/asciinema/asciinema-player">upstream repository</a> for the full sources.</p>
]]></content:encoded></item><item><title>GoHugo Shorturl</title><link>https://cj.rs/gohugo-shorturl/</link><pubDate>Sat, 21 Aug 2021 16:25:33 +0100</pubDate><guid>https://cj.rs/gohugo-shorturl/</guid><description>🔗 Hugo module to create shorturls (so your shorturl like my.site/short can redirect to asitewithalong.name/andanevenlongerpath)</description><content:encoded><![CDATA[
<p style="display: flex; justify-content: space-between">
  <a href="https://github.com/cljoly/gohugo-shorturl" data-goatcounter-click="ext-github-gohugo-shorturl" data-goatcounter-title="cljoly/gohugo-shorturl">
    <span class="svgicon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
    stroke-linecap="round" stroke-linejoin="round">
    <path
        d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22">
    </path>
</svg></span>&nbsp;cljoly/gohugo-shorturl
  </a>
  <a class="badges" href="https://github.com/cljoly/gohugo-shorturl" data-goatcounter-click="ext-stargithub-gohugo-shorturl" data-goatcounter-title="stars cljoly/gohugo-shorturl">
    <img src="https://img.shields.io/github/stars/cljoly/gohugo-shorturl?style=social" alt="Github stars for gohugo-shorturl">
  </a>
</p>

<p>

  <img alt="Min Hugo Version: 0.77.0" loading="lazy" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNjkiIGhlaWdodD0iMjAiIHJvbGU9ImltZyIgYXJpYS1sYWJlbD0ibWluIEh1Z28gdmVyc2lvbjogMC43OC4wIj48dGl0bGU+bWluIEh1Z28gdmVyc2lvbjogMC43OC4wPC90aXRsZT48ZmlsdGVyIGlkPSJibHVyIj48ZmVHYXVzc2lhbkJsdXIgaW49IlNvdXJjZUdyYXBoaWMiIHN0ZERldmlhdGlvbj0iMTYiLz48L2ZpbHRlcj48bGluZWFyR3JhZGllbnQgaWQ9InMiIHgyPSIwIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjYmJiIiBzdG9wLW9wYWNpdHk9Ii4xIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLW9wYWNpdHk9Ii4xIi8+PC9saW5lYXJHcmFkaWVudD48Y2xpcFBhdGggaWQ9InIiPjxyZWN0IHdpZHRoPSIxNjkiIGhlaWdodD0iMjAiIHJ4PSIzIiBmaWxsPS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0ic2NhbGUoLjEpIiB0ZXh0TGVuZ3RoPSI5NzAiPm1pbiBIdWdvIHZlcnNpb248L3RleHQ+PHRleHQgeD0iNzE1IiB5PSIxNDAiIHRyYW5zZm9ybT0ic2NhbGUoLjEpIiBmaWxsPSIjZmZmIiB0ZXh0TGVuZ3RoPSI5NzAiPm1pbiBIdWdvIHZlcnNpb248L3RleHQ+PHRleHQgYXJpYS1oaWRkZW49InRydWUiIHg9IjE0NTUiIHk9IjE1MCIgZmlsbD0iIzAxMDEwMSIgZmlsbC1vcGFjaXR5PSIuODAiIGZpbHRlcj0idXJsKCNibHVyKSIgdHJhbnNmb3JtPSJzY2FsZSguMSkiIHRleHRMZW5ndGg9IjM1MCI+MC43OC4wPC90ZXh0Pjx0ZXh0IGFyaWEtaGlkZGVuPSJ0cnVlIiB4PSIxNDU1IiB5PSIxNTAiIGZpbGw9IiMwMTAxMDEiIGZpbGwtb3BhY2l0eT0iLjMiIHRyYW5zZm9ybT0ic2NhbGUoLjEpIiB0ZXh0TGVuZ3RoPSIzNTAiPjAuNzguMDwvdGV4dD48dGV4dCB4PSIxNDU1IiB5PSIxNDAiIHRyYW5zZm9ybT0ic2NhbGUoLjEpIiBmaWxsPSIjZmZmIiB0ZXh0TGVuZ3RoPSIzNTAiPjAuNzguMDwvdGV4dD48L2c+PC9zdmc+"></p>
<p>Create shorter urls to external resources for your own convenience or to your own content, to get the <a href="https://sive.rs/su">benefits described by Derek Sivers</a>.</p>
<h2 id="install">Install</h2>
<p>If you haven’t used hugo modules before (you need the go compiler):</p>
<pre tabindex="0"><code>hugo mod init &lt;my-module-path&gt;
</code></pre><p>more details in <a href="https://gohugo.io/hugo-modules/use-modules/">hugo docs</a>.</p>
<p>Then run:</p>
<pre tabindex="0"><code>hugo mod get -u -v joly.pw/gohugo-shorturl
</code></pre><p>and edit your hugo config, for instance for <code>config.toml</code></p>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-toml" data-lang="toml"><span style="display:flex;"><span>[<span style="color:#e06c75">module</span>]
</span></span><span style="display:flex;"><span>  [[<span style="color:#e06c75">module</span>.<span style="color:#e06c75">imports</span>]]
</span></span><span style="display:flex;"><span>    <span style="color:#e06c75">path</span> = <span style="color:#98c379">&#34;joly.pw/gohugo-shorturl&#34;</span>
</span></span></code></pre></div><h2 id="use">Use</h2>
<p>Imagine we want to create the short url <em><a href="https://my.site/a">https://my.site/a</a></em> and to have it redirect to <em><a href="https://gohugo.io/content-management/archetypes/#directory-based-archetypes">https://gohugo.io/content-management/archetypes/#directory-based-archetypes</a></em>:</p>
<pre tabindex="0"><code>hugo new --kind shorturl content/a.md
</code></pre><p>and then edit <code>content/a.md</code>:</p>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#e06c75">---</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">title</span>: <span style="color:#98c379">&#34;A&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">date</span>: 2021-03-07T13:57:13Z
</span></span><span style="display:flex;"><span><span style="color:#e06c75">draft</span>: <span style="color:#e5c07b">true</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">type</span>: <span style="color:#98c379">&#34;shorturl&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">shortto</span>: <span style="color:#98c379">&#34;&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">---</span>
</span></span></code></pre></div><p>Change the <code>shortto</code> above to <em><a href="https://gohugo.io/content-management/archetypes/#directory-based-archetypes">https://gohugo.io/content-management/archetypes/#directory-based-archetypes</a></em> and <code>draft</code> to <code>false</code></p>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#e06c75">---</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">title</span>: <span style="color:#98c379">&#34;A&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">date</span>: 2021-03-07T13:57:13Z
</span></span><span style="display:flex;"><span><span style="color:#e06c75">draft</span>: <span style="color:#e5c07b">true</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">type</span>: <span style="color:#98c379">&#34;shorturl&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">shortto</span>: <span style="color:#98c379">&#34;https://gohugo.io/content-management/archetypes/#directory-based-archetypes&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">---</span>
</span></span></code></pre></div><p>Then deploy <em>my.site</em> and open <em><a href="https://my.site/a">https://my.site/a</a></em>, you will be redirected!</p>
<h2 id="other-parameters">Other parameters</h2>
<p>See <a href="https://developers.google.com/search/docs/advanced/robots/robots_meta_tag?hl=en#directives">https://developers.google.com/search/docs/advanced/robots/robots_meta_tag?hl=en#directives</a></p>
<h2 id="contribute">Contribute</h2>
<p>You may use a local version of this module in hugo like this:</p>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-toml" data-lang="toml"><span style="display:flex;"><span>[<span style="color:#e06c75">module</span>]
</span></span><span style="display:flex;"><span><span style="color:#e06c75">replacements</span> = <span style="color:#98c379">&#34;joly.pw/gohugo-shorturl -&gt; /some/path/gohugo-shorturl&#34;</span>
</span></span><span style="display:flex;"><span>[[<span style="color:#e06c75">module</span>.<span style="color:#e06c75">imports</span>]]
</span></span><span style="display:flex;"><span><span style="color:#e06c75">path</span> = <span style="color:#98c379">&#34;joly.pw/gohugo-shorturl&#34;</span>
</span></span></code></pre></div><p>Please consider sending a PR with your patches, it’s always appreciated and will save you the trouble of maintaining the changes on your own!</p>
]]></content:encoded></item><item><title>README In Static Site (RISS)</title><link>https://cj.rs/readme-in-static-site/</link><pubDate>Sat, 21 Aug 2021 08:15:54 +0100</pubDate><guid>https://cj.rs/readme-in-static-site/</guid><description>💎 Transform and insert your GitHub readme in your static site</description><content:encoded><![CDATA[<p>
<p style="display: flex; justify-content: space-between">
  <a href="https://codeberg.org/cljoly/readme-in-static-site" data-goatcounter-click="ext-codeberg-readme-in-static-site" data-goatcounter-title="cljoly/readme-in-static-site">
    <span class="svgicon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="none">
    <path
        d='M11.955.49A12 12 0 0 0 0 12.49a12 12 0 0 0 1.832 6.373L11.838 5.928a.187.14 0 0 1 .324 0l10.006 12.935A12 12 0 0 0 24 12.49a12 12 0 0 0-12-12 12 12 0 0 0-.045 0zm.375 6.467l4.416 16.553a12 12 0 0 0 5.137-4.213z' />
</svg></span>&nbsp;cljoly/readme-in-static-site
  </a>
  <a class="badges" href="https://github.com/cljoly/readme-in-static-site" data-goatcounter-click="ext-stargithub-readme-in-static-site" data-goatcounter-title="stars cljoly/readme-in-static-site">
    <img src="https://img.shields.io/github/stars/cljoly/readme-in-static-site?style=social" alt="Github stars for readme-in-static-site">
  </a>
</p>


<div class="badges">
</p>
<p><a href="https://github.com/cljoly/readme-in-static-site/blob/main/riss.awk">
<img alt="GitHub code size in bytes" loading="lazy" src="https://img.shields.io/github/size/cljoly/readme-in-static-site/riss.awk?color=purple"></a> 
<img alt="GitHub tag (latest SemVer)" loading="lazy" src="https://img.shields.io/github/v/tag/cljoly/readme-in-static-site?color=darkgreen&sort=semver"> <a href="https://github.com/cljoly/readme-in-static-site/actions/workflows/checks.yml">
<img alt="CI" loading="lazy" src="https://codeberg.org/cljoly/readme-in-static-site/actions/workflows/checks.yml/badge.svg"></a> <a href="https://cj.rs/riss">

  <img loading="lazy" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDQiIGhlaWdodD0iMjAiIHJvbGU9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ybT0ic2NhbGUoLjEpIiB0ZXh0TGVuZ3RoPSI2NTAiPnBvd2VyZWQgYnk8L3RleHQ+PHRleHQgYXJpYS1oaWRkZW49InRydWUiIHg9IjM4NSIgeT0iMTUwIiBmaWxsPSIjMDEwMTAxIiBmaWxsLW9wYWNpdHk9Ii4zIiB0cmFuc2Zvcm09InNjYWxlKC4xKSIgdGV4dExlbmd0aD0iNjUwIj5wb3dlcmVkIGJ5PC90ZXh0Pjx0ZXh0IHg9IjM4NSIgeT0iMTQwIiB0cmFuc2Zvcm09InNjYWxlKC4xKSIgZmlsbD0iI2ZmZiIgdGV4dExlbmd0aD0iNjUwIj5wb3dlcmVkIGJ5PC90ZXh0Pjx0ZXh0IGFyaWEtaGlkZGVuPSJ0cnVlIiB4PSI4ODUiIHk9IjE1MCIgZmlsbD0iIzAxMDEwMSIgZmlsbC1vcGFjaXR5PSIuODAiIGZpbHRlcj0idXJsKCNibHVyKSIgdHJhbnNmb3JtPSJzY2FsZSguMSkiIHRleHRMZW5ndGg9IjE5MCI+cmlzczwvdGV4dD48dGV4dCBhcmlhLWhpZGRlbj0idHJ1ZSIgeD0iODg1IiB5PSIxNTAiIGZpbGw9IiMwMTAxMDEiIGZpbGwtb3BhY2l0eT0iLjMiIHRyYW5zZm9ybT0ic2NhbGUoLjEpIiB0ZXh0TGVuZ3RoPSIxOTAiPnJpc3M8L3RleHQ+PHRleHQgeD0iODg1IiB5PSIxNDAiIHRyYW5zZm9ybT0ic2NhbGUoLjEpIiBmaWxsPSIjZmZmIiB0ZXh0TGVuZ3RoPSIxOTAiPnJpc3M8L3RleHQ+PC9nPjwvc3ZnPg=="></a></p>
<p>
<img alt="RISS in action" loading="lazy" src="/blog/putting-readmes-on-your-static-site/riss-in-action.png"></p>

</div>

<p>This <a href="#benchmark">fast</a> <a href="https://cj.rs/riss.awk">script</a> allows you to insert your GitHub README in your static site and apply transformations. For instance, you can read this <a href="https://github.com/cljoly/readme-in-static-site/blob/main/README.md">README on GitHub</a> and <a href="https://cj.rs/readme-in-static-site">on my website</a>.</p>
<h3 id="why">Why?</h3>
<p>The GitHub README of your repo needs to efficiently describe your project to GitHub’s visitor. But featuring your project on your website allows you to (among other things):</p>
<ul>
<li>have more control on the theme and layout,</li>
<li>insert scripts that GitHub would prohibit (like <a href="#replace-asciinema-image">asciinema</a>),</li>
<li>have your project’s homepage independent of your hosting platform, if you wish to change at some point.</li>
</ul>
<p>Chances are that for small projects, the page about your project is very similar to the GitHub README. Don’t duplicate efforts, describe the differences! This <a href="https://github.com/vhodges/stitcherd">has</a> <a href="https://dev.to/lornasw93/github-readme-on-portfolio-project-page-51i8">been</a> a <a href="https://richjenks.com/github-pages-from-readme/">long-awaited</a> <a href="https://medium.com/@bolajiayodeji/how-to-convert-github-markdown-files-to-a-simple-website-b08602d05e1c">feature</a>, in <a href="https://news.ycombinator.com/item?id=29305990">one</a> <a href="https://stackoverflow.com/q/48919200/4253785">form</a> or <a href="https://stackoverflow.com/a/69296054/4253785">another</a>.</p>
<p>See this <a href="https://cj.rs/blog/putting-readmes-on-your-static-site/">blog post</a> for more details.</p>
<h2 id="testimonials">Testimonials</h2>
<p><a href="https://news.ycombinator.com/item?id=29304376">
<img loading="lazy" src="https://img.shields.io/badge/dynamic/json?color=Orange&label=HackerNews&query=%24.score&url=https%3A%2F%2Fhacker-news.firebaseio.com%2Fv0%2Fitem%2F29304376.json&logo=ycombinator&color=orange"></a> <a href="https://lobste.rs/s/a4jzvv/readme_static_site_riss#c_hiil4z.json">
<img loading="lazy" src="https://img.shields.io/badge/dynamic/json?color=green&label=Lobsters&query=%24.score&url=https%3A%2F%2Flobste.rs%2Fs%2Fa4jzvv%2Freadme_static_site_riss.json&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAL0ALQAtZF7+HAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9wCCBAuLt2rqugAAACMSURBVDjL1ZMxCsJQEERfRPEk9im9mGfxBpaCnaXmBraeQEidKsKz2eIb/peEIOLAwu4Ws7PMbsUAKlOwYCaWmd4aWCV1B4yXpR59R61SitwKDdBHfgPaSTsF8zOmHz5NLykAeCRqvuvCfxGcgP0YF3ZqHy7c1Yt6jfo8dCF3idvkQjcRRVQ/f6bZBC+RBoeZnlCyqwAAAABJRU5ErkJggg==&labelColor=500000"></a></p>
<p>RISS made it to the first page of <a href="https://news.ycombinator.com/item?id=29304376">HackerNews</a> and <a href="https://lobste.rs/s/a4jzvv/readme_static_site_riss">Lobsters</a> and got comments like:</p>




  <figure>
    <blockquote >
      <p>I never really understood the idea to have a separate README and index page. Glad to see i&rsquo;m not the only one :)</p>

    </blockquote>
    
  </figure>



<p><a href="https://news.ycombinator.com/item?id=29305519">southerntofu</a></p>




  <figure>
    <blockquote >
      <p>Kudos for making it reusable and not specific to a single static site generator. […]</p>

    </blockquote>
    
  </figure>



<p><a href="https://lobste.rs/s/a4jzvv/readme_static_site_riss#c_hiil4z">hannu</a></p>




  <figure>
    <blockquote >
      <p>[…] A small but good idea, I like how simple riss.awk is.</p>

    </blockquote>
    
  </figure>



<p><a href="https://news.ycombinator.com/item?id=29305070">lifthrasiir</a></p>
<h3 id="run-it-nothing-to-install">Run It (Nothing to Install)</h3>
<p>To try it with <a href="https://gohugo.io/">Hugo</a> or <a href="https://www.getzola.org/">Zola</a>, run the following in your static-site sources:</p>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span>wget https://cj.rs/riss.awk
</span></span><span style="display:flex;"><span>awk -f riss.awk /path/to/my-project/README.md &gt; content/my-project.md
</span></span></code></pre></div><p>If you don’t use Hugo or Zola, no problem! It should also work with any markdown-based static-site generator. Just put the markdown file where it makes sense for that generator.</p>
<p>To automatically update these files in your static-site sources, see <a href="#automate-with-github-actions">Automate with GitHub Actions</a> below. Since RISS is based on Awk, there is nothing to install, besides copying the script itself!</p>
<h2 id="example">Example</h2>
<h3 id="add-a-front-matter">Add a Front Matter</h3>
<p>Most static site generators require a “<a href="https://gohugo.io/getting-started/configuration/#configure-front-matter">front matter</a>” at the beginning of a markdown file to attach some metadata. But you don’t want to add this to your GitHub README! Let’s hide this on GitHub and have it in the script’s output.</p>
<p>In you .md file on GitHub, put:</p>
<pre><code>&lt;!-- insert
---
title: &quot;README In Static Site (RISS)&quot;
date: 2021-08-21T10:15:54
---
end_insert --&gt;
&lt;!-- Powered by https://cj.rs/riss --&gt;
&lt;!-- remove --&gt;

# README In Static Site (RISS)
&lt;!-- end_remove --&gt;
</code></pre>
<p>The output of the script will be:</p>
<pre><code>---
title: &quot;README In Static Site (RISS)&quot;
date: 2021-08-21T10:15:54
---
&lt;!-- Powered by https://cj.rs/riss --&gt;
</code></pre>
<p>and this piece of yaml will be hidden on GitHub!</p>
<h3 id="replace-asciinema-image">Replace Asciinema Image</h3>
<p>You can’t embed the asciinema player on GitHub for security reasons. So the <a href="https://asciinema.org/docs/embedding">asciinema documentation</a> suggests using an image there and to link it to a webpage with the player. But on your own website, you can embed this player.</p>
<p>In your .md file, put:</p>
<pre><code>&lt;!-- remove --&gt;
[![Finding the repositories with “telescope” in their name, with the README in the panel on the right](https://asciinema.org/a/427156.svg)](https://asciinema.org/a/427156)
&lt;!-- end_remove --&gt;
&lt;!-- insert
&lt;asciinema-player src=&quot;./telescope.cast&quot; poster=&quot;npt:0:04&quot;&gt;&lt;/asciinema-player&gt;
end_insert --&gt;
</code></pre>
<p>The output will contain only the asciinema player:</p>
<pre><code>&lt;asciinema-player src=&quot;./telescope.cast&quot; poster=&quot;npt:0:04&quot;&gt;&lt;/asciinema-player&gt;
</code></pre>
<p><em>Note</em>: you also need to add the JS/CSS files of the asciinema player somewhere in your theme. This <a href="https://cj.rs/gohugo-asciinema/">Hugo module</a> makes it easy.</p>
<h3 id="more">More</h3>
<p>See the <a href="https://github.com/cljoly/readme-in-static-site/blob/main/test.md">input file (typically on GitHub)</a> and the <a href="https://github.com/cljoly/readme-in-static-site/blob/main/test_output.md">output of the script</a>. You can find another real word <a href="https://github.com/cljoly/telescope-repo.nvim/blob/master/README.md">README</a> converted to a <a href="https://cj.rs/telescope-repo-nvim/">webpage</a> (this gives another example of asciinema conversion using a Hugo shortcode).</p>
<p>With some shell scripting, you could also transform all the markdown files in your repo and put them in a subdirectory of your site, so that your project’s documentation, policy, etc… lives on your site or even on a site of its own.</p>
<h3 id="your-example">Your Example!</h3>
<p>Have you used this script to transform some markdown (or other) and insert it on your website? <a href="https://github.com/cljoly/readme-in-static-site/issues/new">Open an issue</a> if you would like a link to your use case from this README!</p>
<ul>
<li><strong>telescope-repo.nvim</strong>: <a href="https://github.com/cljoly/telescope-repo.nvim/blob/master/README.md">readme</a>, <a href="https://cj.rs/telescope-repo-nvim/">website</a>; features an Asciinema clip.</li>
<li><strong>neovide</strong>: <a href="https://github.com/neovide/neovide/blob/main/README.md">readme</a>, <a href="https://neovide.dev/">first iteration of their website</a>, <a href="https://github.com/neovide/neovide/pull/1114">PR setting this up</a>. They have now moved to mdbook and that’s great! RISS makes the first iteration of your website easy and you are free to move to more complete solutions when your project grows.</li>
<li><strong>Hugo APT Repository</strong>: <a href="https://github.com/8hobbies/hugo-apt/blob/master/README.md">readme</a>, <a href="https://hugo-apt.8hob.io/">website</a>, <a href="https://github.com/8hobbies/hugo-apt/pull/12">PR setting it up</a>.</li>
</ul>
<h2 id="transformations-reference">Transformations Reference</h2>
<p>The transformations are driven by HTML comments, so that you can have different results when comments are ignored (e.g. in your GitHub README) and after executing the script on your markdown file.</p>
<h3 id="escaping">Escaping</h3>
<p><strong>It is important that your comment starts at the beginning of the line:</strong> spaces are used for escaping, meaning that if the comment has spaces at the beginning of the line, it is ignored.</p>
<p>So this is escaped</p>
<pre tabindex="0"><code>    &lt;!-- insert
</code></pre><p>but this is not</p>
<pre><code>&lt;!-- insert
</code></pre>
<h3 id="insertion">Insertion</h3>
<p>Use these two lines for text you want to have in your output, but not in the raw .md file.</p>
<pre><code>&lt;!-- insert
end_insert --&gt;
</code></pre>
<h3 id="remove">Remove</h3>
<p>Use these two comments for text you want to have in your raw .md file, but not in the output</p>
<pre><code>&lt;!-- remove --&gt;
&lt;!-- end_remove --&gt;
</code></pre>
<h2 id="spread-the-word">Spread the Word</h2>
<p>If you find this script useful, please consider inserting the following in your readme:</p>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-html" data-lang="html"><span style="display:flex;"><span><span style="color:#7f848e">&lt;!-- Powered by https://cj.rs/riss --&gt;</span>
</span></span></code></pre></div><p>This will help other people find the script. <em>Thanks for spreading the word!</em></p>
<p>If you feel especially charitable, you could put this badge somewhere:</p>
<p><a href="https://cj.rs/riss">

  <img loading="lazy" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDQiIGhlaWdodD0iMjAiIHJvbGU9ImltZyIgYXJpYS1sYWJlbD0icG93ZXJlZCBieTogcmlzcyI+PHRpdGxlPnBvd2VyZWQgYnk6IHJpc3M8L3RpdGxlPjxmaWx0ZXIgaWQ9ImJsdXIiPjxmZUdhdXNzaWFuQmx1ciBpbj0iU291cmNlR3JhcGhpYyIgc3RkRGV2aWF0aW9uPSIxNiIvPjwvZmlsdGVyPjxsaW5lYXJHcmFkaWVudCBpZD0icyIgeDI9IjAiIHkyPSIxMDAlIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiNiYmIiIHN0b3Atb3BhY2l0eT0iLjEiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3Atb3BhY2l0eT0iLjEiLz48L2xpbmVhckdyYWRpZW50PjxjbGlwUGF0aCBpZD0iciI+PHJlY3Qgd2lkdGg9IjEwNCIgaGVpZ2h0PSIyMCIgcng9IjMiIGZpbGw9IiNmZm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cj0idXJsKCNibHVyKSIgdHJhbnNmb3JtPSJzY2FsZSguMSkiIHRleHRMZW5ndGg9IjE5MCI+cmlzczwvdGV4dD48dGV4dCBhcmlhLWhpZGRlbj0idHJ1ZSIgeD0iODg1IiB5PSIxNTAiIGZpbGw9IiMwMTAxMDEiIGZpbGwtb3BhY2l0eT0iLjMiIHRyYW5zZm9ybT0ic2NhbGUoLjEpIiB0ZXh0TGVuZ3RoPSIxOTAiPnJpc3M8L3RleHQ+PHRleHQgeD0iODg1IiB5PSIxNDAiIHRyYW5zZm9ybT0ic2NhbGUoLjEpIiBmaWxsPSIjZmZmIiB0ZXh0TGVuZ3RoPSIxOTAiPnJpc3M8L3RleHQ+PC9nPjwvc3ZnPg=="></a></p>
<p>with for instance this code:</p>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-markdown" data-lang="markdown"><span style="display:flex;"><span>[<span style="color:#e06c75">![</span>](<span style="color:#e06c75">https://img.shields.io/badge/powered%20by-riss-lightgrey</span>)](https://cj.rs/riss)
</span></span></code></pre></div><h2 id="breaking-api-changes">Breaking API Changes</h2>
<p>We follow <a href="https://semver.org/">semver</a> and any change that change would cause real world READMEs to be converted differently requires a new major version. In particular, the following is a breaking change:</p>
<ul>
<li>adding new keywords (like <code>remove</code> or <code>insert</code>), as they may be used in the README prior to their introduction in RISS,</li>
<li>changing a keywords syntax.</li>
</ul>
<h2 id="benchmark">Benchmark</h2>
<p><strong>Processes 17600 lines in 10 ms</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>$ <span style="color:#c678dd">for</span> i in <span style="color:#56b6c2">{</span>1..100<span style="color:#56b6c2">}</span>; <span style="color:#c678dd">do</span> shuf README.md &gt;&gt;bench.md; <span style="color:#c678dd">done</span> <span style="color:#7f848e"># Create a big md file</span>
</span></span><span style="display:flex;"><span>$ wc -l README.md
</span></span><span style="display:flex;"><span><span style="color:#d19a66">176</span> README.md
</span></span><span style="display:flex;"><span>$ wc -l bench.md
</span></span><span style="display:flex;"><span><span style="color:#d19a66">17600</span> bench.md
</span></span><span style="display:flex;"><span>$ hyperfine <span style="color:#98c379">&#39;awk -f riss.awk README.md&#39;</span> <span style="color:#98c379">&#39;awk -f riss.awk bench.md&#39;</span>
</span></span></code></pre></div><table>
  <thead>
      <tr>
          <th style="text-align: left">Command</th>
          <th style="text-align: right">Mean [ms]</th>
          <th style="text-align: right">Min [ms]</th>
          <th style="text-align: right">Max [ms]</th>
          <th style="text-align: right">Relative</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td style="text-align: left"><code>awk -f riss.awk README.md</code></td>
          <td style="text-align: right">2.8 ± 0.2</td>
          <td style="text-align: right">2.4</td>
          <td style="text-align: right">3.7</td>
          <td style="text-align: right">1.00</td>
      </tr>
      <tr>
          <td style="text-align: left"><code>awk -f riss.awk bench.md</code></td>
          <td style="text-align: right">9.7 ± 0.4</td>
          <td style="text-align: right">8.9</td>
          <td style="text-align: right">10.7</td>
          <td style="text-align: right">3.46 ± 0.30</td>
      </tr>
  </tbody>
</table>
<h2 id="automate-with-github-actions">Automate with GitHub Actions</h2>
<p>You can automatically update the markdown file in the sources of your site with GitHub Actions. Add this workflow to, for instance, <code>.github/workflows/readme.yml</code>:</p>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#e06c75">name</span>: Update README files
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">on</span>:
</span></span><span style="display:flex;"><span>  <span style="color:#e06c75">schedule</span>:
</span></span><span style="display:flex;"><span>    - <span style="color:#e06c75">cron</span>: <span style="color:#98c379">&#39;30 */2 * * *&#39;</span>
</span></span><span style="display:flex;"><span>  <span style="color:#e06c75">push</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#e06c75">branches</span>:
</span></span><span style="display:flex;"><span>    - master
</span></span><span style="display:flex;"><span>  <span style="color:#7f848e"># To run this workflow manually from GitHub GUI</span>
</span></span><span style="display:flex;"><span>  <span style="color:#e06c75">workflow_dispatch</span>:
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#e06c75">jobs</span>:
</span></span><span style="display:flex;"><span>  <span style="color:#e06c75">build</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#e06c75">runs-on</span>: ubuntu-latest
</span></span><span style="display:flex;"><span>    <span style="color:#e06c75">steps</span>:
</span></span><span style="display:flex;"><span>    - <span style="color:#e06c75">name</span>: Check out the repo
</span></span><span style="display:flex;"><span>      <span style="color:#e06c75">uses</span>: actions/checkout@v2
</span></span><span style="display:flex;"><span>    - <span style="color:#e06c75">name</span>: Get the latest READMEs
</span></span><span style="display:flex;"><span>      <span style="color:#e06c75">run</span>: make readme-update
</span></span><span style="display:flex;"><span>    - <span style="color:#e06c75">name</span>: Commit and push if there are changes
</span></span><span style="display:flex;"><span>      <span style="color:#e06c75">run</span>: |-<span style="color:#98c379">
</span></span></span><span style="display:flex;"><span><span style="color:#98c379">        git diff
</span></span></span><span style="display:flex;"><span><span style="color:#98c379">        git config --global user.email &#34;bot@example.com&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#98c379">        git config --global user.name &#34;bot&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#98c379">        git diff --quiet || (git add -u &amp;&amp; git commit -m &#34;Update READMEs&#34;)
</span></span></span><span style="display:flex;"><span><span style="color:#98c379">        git push</span>
</span></span></code></pre></div><p>and then your <code>Makefile</code> may contain something like:</p>
<div class="highlight"><pre tabindex="0" style="color:#abb2bf;background-color:#282c34;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-make" data-lang="make"><span style="display:flex;"><span><span style="color:#61afef;font-weight:bold">readme-update</span><span style="color:#56b6c2">:</span>
</span></span><span style="display:flex;"><span>	curl https://raw.githubusercontent.com/cljoly/readme-in-static-site/main/README.md | awk -f riss.awk &gt;content/readme-in-static-site.md
</span></span></code></pre></div><p>Alternatively, you might configure your repositories to trigger a website rebuild when committing on your README, for instance using <a href="https://mainawycliffe.dev/blog/github-actions-trigger-via-webhooks/">GitHub actions webhooks</a>.</p>
<h2 id="contributions-are-welcome">Contributions are Welcome!</h2>
<p>Feel free to <a href="https://github.com/cljoly/readme-in-static-site/issues/new">open an issue</a> to discuss something or to send a PR.</p>
<p>See also the <a href="#spread-the-word">Spread the Word</a> section if you would like to make more folks aware of this script.</p>
<p>
<img alt="GitHub" loading="lazy" src="https://img.shields.io/github/license/cljoly/readme-in-static-site"></p>
]]></content:encoded></item></channel></rss>