<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts | Academic</title><link>https://pxq.grokcv.ai/post/</link><atom:link href="https://pxq.grokcv.ai/post/index.xml" rel="self" type="application/rss+xml"/><description>Posts</description><generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><image><url>https://pxq.grokcv.ai/media/icon_hu0b7a4cb9992c9ac0e91bd28ffd38dd00_9727_512x512_fill_lanczos_center_3.png</url><title>Posts</title><link>https://pxq.grokcv.ai/post/</link></image><item><title>Static Website from Hugo/Wowchemy</title><link>https://pxq.grokcv.ai/post/static-site-hugo-wowchemy/</link><pubDate>Wed, 27 Dec 2023 17:02:44 +0800</pubDate><guid>https://pxq.grokcv.ai/post/static-site-hugo-wowchemy/</guid><description>&lt;p>本文会介绍：&lt;/p>
&lt;ul>
&lt;li>静态网站&lt;/li>
&lt;li>静态网站生成工具 Hugo/Wowchemy&lt;/li>
&lt;li>Wowchemy 模版：Research Group 和 Academic&lt;/li>
&lt;/ul>
&lt;p>我们首先快速上线一个网站，然后配合网站具体讲解。&lt;/p>
&lt;h2 id="快速上线个人子站">快速上线个人子站&lt;/h2>
&lt;p>所谓&lt;strong>个人子站&lt;/strong>没有什么严格定义，在我们团队的规划下暂且定义为：团队成员的个人网站，可以通过团队域名的一个子域名访问到。&lt;/p>
&lt;p>比如你现在浏览的网站 &lt;a href="https://grokcv.ai" target="_blank" rel="noopener">pxq.grokcv.ai&lt;/a> 就是 &lt;a href="https://grokcv.ai" target="_blank" rel="noopener">grokcv.ai&lt;/a>&lt;sup id="fnref:1">&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref">1&lt;/a>&lt;/sup> 的个人子站。&lt;/p>
&lt;p>在我们团队内想要快速上线这样一个网站，只需要三步：&lt;/p>
&lt;ol>
&lt;li>点击 &lt;a href="https://github.com/new?template_name=theme-academic-cv&amp;amp;template_owner=HugoBlox&amp;amp;owner=grokcv&amp;amp;name=pxq-site&amp;amp;visibility=public" target="_blank" rel="noopener">魔法链接&lt;/a>&lt;sup id="fnref:2">&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref">2&lt;/a>&lt;/sup>&lt;/li>
&lt;li>修改 repo 名称为 &lt;strong>yourname-site&lt;/strong>（比如本站的 repo 名称为 pxq-site）&lt;/li>
&lt;li>通知管理员&lt;/li>
&lt;/ol>
&lt;p>如果管理员没在忙，大概10分钟后你就能访问自己的个人子站了。&lt;/p>
&lt;h2 id="静态网站">静态网站&lt;/h2>
&lt;p>前面快速上线的这个网站和常见的博客、企业官网、技术文档等等网站中大多数类似，是一个静态网站&lt;sup id="fnref:3">&lt;a href="#fn:3" class="footnote-ref" role="doc-noteref">3&lt;/a>&lt;/sup>。&lt;/p>
&lt;p>这类网站之所以选择静态网站技术，核心原因是对更新频率的要求比较低（通常更新周期大于构建发布所需要的时间），所以有内容需要更新时重新构建发布一次就好了。
静态网站技术在满足了低频内容型网站的核心需求的同时，也带来许多额外的好处：&lt;/p>
&lt;ul>
&lt;li>安全性较高&lt;/li>
&lt;li>服务器成本更低&lt;/li>
&lt;li>支持的部署平台更广泛&lt;/li>
&lt;/ul>
&lt;p>所有这些好处都来自于静态特性，即用户访问网站时&lt;strong>服务端不执行代码&lt;/strong>。&lt;/p>
&lt;p>有人可能会疑惑，这类网站似乎已经是十多年前的内容展示方式了，目前大家基本都在微信公众号和抖音、B站等音视频平台上消费内容，&lt;strong>为什么还需要静态网站？&lt;/strong>&lt;/p>
&lt;h3 id="1平台存在较强的地域性">1、平台存在较强的地域性&lt;/h3>
&lt;p>希望我们的内容更容易在世界范围内被更多人看到。&lt;/p>
&lt;p>国内百度已经几乎没法用了，搜索入口实际已经转移到了小红书、B站、美团等等。
其中大部分平台都在做去互联网化，原来的各种开放标准因为效率上的劣势和细分需求匹配度低的原因正在逐渐沦为濒危标准。
由于中国互联网发展较晚，这一情况尤为明显，正如移动支付让我们一举跳过信用卡体系，我们的一些公共组织也正在跳过网站的建设，用微信公众号、本地生活类平台做自我介绍和门票售卖等。&lt;/p>
&lt;p>前段时间刚去了日本关西游玩，出行前做攻略时几乎都是直接在小红书、B站上搜索，不过有些意外的发现京都几乎每个寺庙都有自己良好设计的官方网站，比如 &lt;a href="https://www.kiyomizudera.or.jp/" target="_blank" rel="noopener">清水寺&lt;/a>、&lt;a href="https://rurikoin.komyoji.com/" target="_blank" rel="noopener">琉璃光院&lt;/a> 等。
而杭州西湖这般著名的景区，目前只找到管委会的网站上有一段文字介绍 &lt;a href="https://westlake.hangzhou.gov.cn/col/col1598539/index.html" target="_blank" rel="noopener">西湖风景名胜区概况&lt;/a>，但是你能在微信中找到西湖的视频号、公众号，里面都有很优秀的图文音视频内容来展示这个景区。&lt;/p>
&lt;p>想象一下如果京都这些寺庙的介绍是在“日本微信”的公众号里，那我大概率不会看到了。
当然这些内容是否有独立网站来展示并没有什么大问题，甚至对于国内游客来说，在微信平台中展示比网站是更有效的。&lt;/p>
&lt;p>我们科研活动产出的内容适合用被更广泛支持的标准去呈现，让世界各地的读者都能轻松访问。&lt;/p>
&lt;h3 id="2平台的生命周期和数据安全性">2、平台的生命周期和数据安全性&lt;/h3>
&lt;p>经历各种大平台的起起伏伏后，会发现这些大平台的生命周期或许不如我们的内容，至少我们的愿景是希望我们内容的生命比平台更长久。&lt;/p>
&lt;p>同时大平台的数据安全性也不见得更高，最近几个月大家也都有所耳闻，语雀、阿里云等平台接连故障，虽然没有造成严重的数据丢失问题，但是对于重要内容的保存我想应该有些更长远的规划。&lt;/p>
&lt;p>我们目前使用静态网站的方式天然具备了多种形式的备份：&lt;/p>
&lt;ul>
&lt;li>本地 git 仓库&lt;/li>
&lt;li>远端 git 仓库&lt;/li>
&lt;li>线上网站&lt;/li>
&lt;/ul>
&lt;p>本地 git 仓库的存在避免远端 git 仓库服务商（github 等）故障导致数据丢失。&lt;/p>
&lt;p>远端 git 仓库存在避免个人发生意外社区可以继续维护这份内容，也可以轻易部署到新的服务器上。
会想到个人意外源于 2023 年陈皓（左耳朵耗子）突然去世，他的个人站点 &lt;a href="https://coolshell.cn/" target="_blank" rel="noopener">coolshell.cn&lt;/a> 我从大学时期就一直在看，他去世后可能某一天突然就不能访问了。&lt;/p>
&lt;h3 id="3更灵活的表现形式">3、更灵活的表现形式&lt;/h3>
&lt;p>平台能提供的内容表现形式和自建网站相比相对有限，而且目前大多数平台都是移动端优先，而我们产生的内容在PC这类工作设备上的展现占比可能更大。&lt;/p>
&lt;p>我们团队选择了在学术界广泛使用的 Hugo/Wowchemy 这套静态网站工具来构建部署我们的网站。
接下去会介绍这套工具整体的结构思路、关键概念的设计理由，同时为了便于理解，某些部分不会特别严谨。
详细完整的说明可以直接访问它们的官方文档：&lt;a href="https://gohugo.io/documentation/" target="_blank" rel="noopener">Hugo 文档&lt;/a>、 &lt;a href="https://docs.hugoblox.com/" target="_blank" rel="noopener">Wowchemy 文档&lt;/a> 。&lt;/p>
&lt;h2 id="hugo">Hugo&lt;/h2>
&lt;p>作为一个静态网站生成器，其核心功能就是：&lt;/p>
&lt;div class="mermaid">stateDiagram-v2
direction LR
content --> website: hugo
&lt;/div>
&lt;p>我们专注内容生产，其他问题都由 &lt;strong>Hugo&lt;/strong> 来处理。&lt;/p>
&lt;h3 id="content">content&lt;/h3>
&lt;p>内容是什么？内容可以是你的简历介绍，可以是一篇文章等等。
从编程的概念来理解的话，它们共同的本质是一个&lt;strong>对象&lt;/strong>（字典），不同类型的内容有一些不同的字段，比如一篇 post 有三个字段：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="n">post&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">date&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s1">&amp;#39;2023-12-27&amp;#39;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="c1"># 发布日期&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">title&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s1">&amp;#39;文章标题&amp;#39;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="c1"># 文章标题&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">content&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s1">&amp;#39;文章正文&lt;/span>&lt;span class="se">\n&lt;/span>&lt;span class="s1">第二行内容&amp;#39;&lt;/span> &lt;span class="c1"># 正文内容&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>但是使用编程语言中的对象语法来编写内容不是一个明智的选择，就像许多配置文件会使用 &lt;code>yaml&lt;/code> 和 &lt;code>toml&lt;/code> 之类的格式，
markdown 文件中通过 &lt;strong>front matter&lt;/strong> 支持除了正文之外的字段输入，而 &lt;strong>front matter&lt;/strong> 的格式同样支持 &lt;code>yaml&lt;/code>、&lt;code>toml&lt;/code>等。
这样一篇 post 就可以使用 markdown 来编写:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-md" data-lang="md">&lt;span class="line">&lt;span class="cl">&lt;span class="gh"># content/post/demo.md
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gh">&lt;/span>---
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">date: 2023-12-27
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">title: &amp;#34;文章标题&amp;#34;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">---
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">文章正文
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">第二行内容
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>目前为止编写一篇 post 的方式已经相当简单明了，但是大多数时候一种内容的字段可能不止这样3个，包括 post 这类内容也可以有 tags、category 等更多字段:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-md" data-lang="md">&lt;span class="line">&lt;span class="cl">&lt;span class="gh"># content/post/demo.md
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gh">&lt;/span>---
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">date: 2023-12-27
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">title: &amp;#34;文章标题&amp;#34;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">tags: [&amp;#34;Hugo&amp;#34;, &amp;#34;Wowchemy&amp;#34;]
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">category: &amp;#34;demo&amp;#34;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">---
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">文章正文
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">第二行内容
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>这里有个问题，如果内容字段很多，当我们要新增一篇 post 时都要重复编写 date/title/tags/category 等这些字段，这样的重复行为会让人厌烦，我的第一反应是复制已有的一个文件，然后修改字段内容。
接着又发现 date 这个字段就是新建 post 的时候的日期，那自动生成就好了，不如写个 python 脚本来完成内容模版的生成：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># gen_post.py&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kn">import&lt;/span> &lt;span class="nn">datetime&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">def&lt;/span> &lt;span class="nf">print_post_md&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">title&lt;/span>&lt;span class="p">):&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nb">print&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="sa">f&lt;/span>&lt;span class="s1">&amp;#39;&amp;#39;&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1">---
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1">title: &lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">title&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s1">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1">date: &lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">datetime&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">date&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">today&lt;/span>&lt;span class="p">()&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s1">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1">tags: []
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1">category:
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1">---
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s1">&amp;#39;&amp;#39;&amp;#39;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">if&lt;/span> &lt;span class="vm">__name__&lt;/span> &lt;span class="o">==&lt;/span> &lt;span class="s1">&amp;#39;__main__&amp;#39;&lt;/span>&lt;span class="p">:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">print_post_md&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s1">&amp;#39;文章标题&amp;#39;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>然后在项目根目录执行 &lt;code>python gen_post.py &amp;gt; content/post/demo.md&lt;/code> 即可，当我们需要新增其他内容比如简历时可以再写一个脚本比如 &lt;code>gen_resume.py&lt;/code>。&lt;/p>
&lt;p>其实 Hugo 已经考虑到了这个需求，引入了相关概念称为 &lt;strong>Archetype&lt;/strong>。&lt;/p>
&lt;h3 id="archetype">Archetype&lt;/h3>
&lt;p>Archetype 表示一种内容的模版，比如 post 的 archetype 可以是这样：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-md" data-lang="md">&lt;span class="line">&lt;span class="cl">&lt;span class="gh"># archetypes/post.md
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gh">&lt;/span>---
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">title: &amp;#39;{{ replace .File.ContentBaseName &amp;#34;-&amp;#34; &amp;#34; &amp;#34; | title }}&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">date: &amp;#39;{{ .Date }}&amp;#39;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">tags: []
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">category:
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">---
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Hugo 在创建内容文件时会通过某些规则&lt;sup id="fnref:4">&lt;a href="#fn:4" class="footnote-ref" role="doc-noteref">4&lt;/a>&lt;/sup>找到对应的 archetype，并且将 &lt;code>{{ .Date }}&lt;/code> 这类占位替换为计算后的值。
常用的 archetype 查找规则&lt;sup id="fnref1:4">&lt;a href="#fn:4" class="footnote-ref" role="doc-noteref">4&lt;/a>&lt;/sup>是通过&lt;strong>内容目录&lt;/strong>自动查找，
比如执行命令：&lt;code>hugo new content post/demo.md&lt;/code> 表示要创建一个内容文件 &lt;code>demo.md&lt;/code>，它的的路径是 &lt;code>content/post/demo.md&lt;/code>，那么它的目录就是 &lt;code>post&lt;/code>，Hugo 就会自动查找到 &lt;code>archetypes/post.md&lt;/code> 文件作为 archetype 来生成 &lt;code>post/demo.md&lt;/code> 文件。
所以现在 Hugo 的功能结构可以理解为：&lt;/p>
&lt;div class="mermaid">stateDiagram-v2
direction LR
archetype --> content: hugo new content
content --> website: hugo
&lt;/div>
&lt;p>现在有了辅助我们生成内容的工具 archetype，再来看下从内容到网站：&lt;/p>
&lt;div class="mermaid">stateDiagram-v2
direction LR
content --> website: hugo
&lt;/div>
&lt;p>这一步是怎么做的。&lt;/p>
&lt;p>在此之前我们知道网站有一系列网页构成，网页最基础的格式是 HTML，所以问题就简化成 Hugo 如何生成 HTML，为此 Hugo 引入的相关概念是 &lt;strong>Template&lt;/strong>。&lt;/p>
&lt;h3 id="template">Template&lt;/h3>
&lt;p>template 是一些使用 Go 语言模版&lt;sup id="fnref:5">&lt;a href="#fn:5" class="footnote-ref" role="doc-noteref">5&lt;/a>&lt;/sup>语法编写的 &lt;code>.html&lt;/code> 文件，存放在 &lt;code>layouts&lt;/code> 目录下。
Hugo 在生成网页时会把 content 中的字段插入到 template 对应的位置，所以生成网页的过程可以理解为 content + template =&amp;gt; HTML：&lt;/p>
&lt;div class="mermaid">stateDiagram-v2
direction LR
content --> hugo
template --> hugo
hugo --> HTML
&lt;/div>
&lt;p>比如单个 post 页面的 template 可以是这样：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-html" data-lang="html">&lt;span class="line">&lt;span class="cl">&lt;span class="cp">&amp;lt;!- layouts/post.html -&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">&amp;lt;&lt;/span>&lt;span class="nt">html&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;&lt;/span>&lt;span class="nt">head&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;&lt;/span>&lt;span class="nt">title&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>{{ .Title }}&lt;span class="p">&amp;lt;/&lt;/span>&lt;span class="nt">title&lt;/span>&lt;span class="p">&amp;gt;&lt;/span> &lt;span class="cp">&amp;lt;!- .Title 对应 front matter 中的 title 字段 -&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;/&lt;/span>&lt;span class="nt">head&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;&lt;/span>&lt;span class="nt">body&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;&lt;/span>&lt;span class="nt">header&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;&lt;/span>&lt;span class="nt">div&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>{{ .Date }}&lt;span class="p">&amp;lt;/&lt;/span>&lt;span class="nt">div&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;/&lt;/span>&lt;span class="nt">header&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;&lt;/span>&lt;span class="nt">main&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>{{ .Content }}&lt;span class="p">&amp;lt;/&lt;/span>&lt;span class="nt">main&lt;/span>&lt;span class="p">&amp;gt;&lt;/span> &lt;span class="cp">&amp;lt;!- .Content 对应 .md 文件中的正文 -&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;/&lt;/span>&lt;span class="nt">body&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">&amp;lt;/&lt;/span>&lt;span class="nt">html&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>结合 &lt;code>post/demo.md&lt;/code> 中的字段，会生成类似如下 HTML:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-html" data-lang="html">&lt;span class="line">&lt;span class="cl">&lt;span class="p">&amp;lt;&lt;/span>&lt;span class="nt">html&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;&lt;/span>&lt;span class="nt">head&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;&lt;/span>&lt;span class="nt">title&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>demo&lt;span class="p">&amp;lt;/&lt;/span>&lt;span class="nt">title&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;/&lt;/span>&lt;span class="nt">head&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;&lt;/span>&lt;span class="nt">body&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;&lt;/span>&lt;span class="nt">header&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;&lt;/span>&lt;span class="nt">div&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>2024-01-01&lt;span class="p">&amp;lt;/&lt;/span>&lt;span class="nt">div&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;/&lt;/span>&lt;span class="nt">header&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;&lt;/span>&lt;span class="nt">main&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>文章正文&lt;span class="p">&amp;lt;/&lt;/span>&lt;span class="nt">main&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">&amp;lt;/&lt;/span>&lt;span class="nt">body&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">&amp;lt;/&lt;/span>&lt;span class="nt">html&lt;/span>&lt;span class="p">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>到此 Hugo 的功能结构大致可以理解成:&lt;/p>
&lt;div class="mermaid">stateDiagram-v2
direction LR
archetype --> content: hugo new content
content --> hugo
template --> hugo
hugo --> HTML
&lt;/div>
&lt;ul>
&lt;li>编写 archetype 文件&lt;/li>
&lt;li>使用 &lt;code>hugo new content archetype/file.md&lt;/code> 生成内容文件&lt;/li>
&lt;li>编写 template&lt;/li>
&lt;li>生成网页&lt;/li>
&lt;/ul>
&lt;p>接着我们会发现，我们要编写的内容类型是不是和别人的都差不多，比如 post、resume 等，
我们要展示的网站样子是不是也和别人差不多，或者我就想直接借用其他一个网站的样子。&lt;/p>
&lt;p>因为我们真正关注的是内容本身，所以 Hugo 引入了 &lt;strong>Theme&lt;/strong> 来提供除了内容本身之外其他功能的分享复用机制。&lt;/p>
&lt;h3 id="theme">Theme&lt;/h3>
&lt;p>在说明 theme 之前，先来了解一下 Hugo 的 &lt;strong>7 大组件（目录）&lt;/strong>：&lt;/p>
&lt;ul>
&lt;li>&lt;em>archetypes&lt;/em>&lt;/li>
&lt;li>&lt;em>content&lt;/em>&lt;/li>
&lt;li>&lt;em>layouts&lt;/em>&lt;/li>
&lt;li>assets&lt;/li>
&lt;li>data&lt;/li>
&lt;li>i18n&lt;/li>
&lt;li>static&lt;/li>
&lt;/ul>
&lt;p>其中 archetypes/content/layouts 前面已经讲到过，剩下几个分别用作：&lt;/p>
&lt;ul>
&lt;li>assets: 样式等资源文件&lt;/li>
&lt;li>data: 大型结构化数据（不适合放在 front matter 中）&lt;/li>
&lt;li>i18n: 国际化多语言相关&lt;/li>
&lt;li>static: 全局静态资源等&lt;/li>
&lt;/ul>
&lt;p>前面有意避开了这 4 个目录，本文后续也不做过多说明，因为不影响对整体结构的理解。
这 7 大组件共同作为源文件，被 Hugo 处理后生成最终的网站。&lt;/p>
&lt;p>那么 theme 是什么，theme 是一个子目录，内部同样是这 7 大组件:
&lt;video src="./theme-dir.av1.mp4" controls>&lt;/video>
Hugo 在生成网站时通过某种优先级规则&lt;strong>合并&lt;/strong>了主目录和 theme 目录下 7 大组件的文件。&lt;/p>
&lt;p>所以当我们看到某个网站的 theme 正是我们想要的，就可以直接复制到我们自己网站的 themes 目录下。&lt;/p>
&lt;p>接着当这个 theme 无法满足我们的需求时，比如原来的 theme 只实现了 post，你想增加 resume，可以在主目录的 7 大组件下直接新增对应的文件来实现，因为合并规则的优先级是 主目录 &amp;gt; theme。&lt;/p>
&lt;p>这时候又出现了一个问题，你的需求大概率也不是一个特殊的需求，所以你的实现可以分享给别人，也可以找到已有的实现。&lt;/p>
&lt;p>关于分享和复用，有几种方式：&lt;/p>
&lt;ol>
&lt;li>直接在 theme 目录中修改，他人复用时直接复制粘贴&lt;/li>
&lt;li>将 theme 独立出去使用 git submodule 引入&lt;/li>
&lt;/ol>
&lt;p>第一种方式很原始，他人也很难及时了解 theme 的更新。
第二种方式解决了 theme 的独立管理，快速跟进更新，但是 git submodule 本身设计存在缺陷&lt;sup id="fnref:6">&lt;a href="#fn:6" class="footnote-ref" role="doc-noteref">6&lt;/a>&lt;/sup>，也不是一个良好的实践。&lt;/p>
&lt;p>关于使用已有的实现，Hugo 其实还有更多考虑：支持&lt;strong>多 theme 合并&lt;/strong>，可以指定多个 theme 的优先级关系，比如 主目录 &amp;gt; theme1 &amp;gt; theme2。
但是这样的多 theme 还是存在一些问题，比如两个 theme 都实现了 A、B 两个功能，我想使用 theme1 的 A 和 theme2 的 B 就没法实现，而每个 theme 如果只实现一个功能那也不符合 theme 这个概念的含义。
从上面可以看出，在当前 theme 这个概念下继续支持更灵活配置，会让其过于复杂。&lt;/p>
&lt;p>theme 最初的设计是简洁清晰的，但是在当下技术体系（使用 git 之类的进行版本管理等）和更灵活的使用需求（将多个theme上的功能结合起来使用等）上有点力不从心。
因此 Hugo 后续推出了 &lt;strong>modules&lt;/strong> 概念。&lt;/p>
&lt;h3 id="modules">Modules&lt;/h3>
&lt;p>module 的组成同样是 7 大组件，和 theme 的区别是：&lt;/p>
&lt;ul>
&lt;li>从概念上来说，一个 module 可以表达从一个功能到一个 theme 的任意范围，甚至可以不是完整的功能（只作为其他 module 的依赖项）&lt;/li>
&lt;li>正如 Hugo 使用 Go 语言模版语法一样，Hugo modules 直接使用 Go 语言的模块机制来分发和使用，就像在 Python 中使用 pip。&lt;/li>
&lt;/ul>
&lt;p>至此我们使用 Hugo 整体结构可以理解为：&lt;/p>
&lt;div class="mermaid">stateDiagram-v2
direction LR
archetypes_in_modules --> content: hugo new content
content --> website: other components in modules
&lt;/div>
&lt;p>既然 Hugo 提供了模块机制，不难想象已经有团队推出基于 Hugo modules 的主题模版，没错就是 &lt;strong>Wowchemy&lt;/strong>。&lt;/p>
&lt;h2 id="wowchemy">Wowchemy&lt;/h2>
&lt;p>Wowchemy 最初的命名可能来自 Wow + alchemy =&amp;gt; Wowchemy，表示扔进去一堆 &lt;code>.md&lt;/code> 文件，输出一个漂亮的网站，这一&lt;strong>神奇&lt;/strong>的转化过程。&lt;/p>
&lt;p>Wowchemy 组织下有许多项目，主要可以分为两类：&lt;/p>
&lt;ol>
&lt;li>几个相互配合的 &lt;strong>Hugo modules&lt;/strong>&lt;/li>
&lt;li>使用这些 Hugo modules 配置好的几个 &lt;strong>repo template&lt;/strong>&lt;/li>
&lt;/ol>
&lt;h3 id="hugo-modules">Hugo modules&lt;/h3>
&lt;p>Wowchemy 提供的 Hugo modules 包括：&lt;/p>
&lt;ul>
&lt;li>core：其他 module 的公共部分&lt;/li>
&lt;li>seo：搜索引擎优化&lt;/li>
&lt;li>bootstrap：使用 bootstrap 作为样式库的一个通用 theme module，后面会详细说明&lt;/li>
&lt;li>tailwind：和 bootstrap 类似，tailwind 是最近几年 Web 前端比较流行的样式库&lt;/li>
&lt;li>decap-cms：使用 git api 作为后端的内容管理&lt;/li>
&lt;li>netlify：在 netlify 上部署相关的 module&lt;/li>
&lt;li>reveal：在线 Slides&lt;/li>
&lt;/ul>
&lt;h3 id="repo-template">Repo template&lt;/h3>
&lt;p>Github 这类服务商提供了 repo template 的功能，用来快速创建同一类型的 repo，&lt;a href="#%e5%bf%ab%e9%80%9f%e4%b8%8a%e7%ba%bf%e4%b8%aa%e4%ba%ba%e5%ad%90%e7%ab%99">快速上线个人子站&lt;/a> 正是使用了 Wowchemy 提供的 repo template &lt;strong>Academic&lt;/strong> 来帮助我们快速创建自己的 Academic 网站源码 repo。
Wowchemy 提供的所有 templates 可以查看 &lt;a href="https://hugoblox.com/templates/" target="_blank" rel="noopener">Wowchemy templates&lt;/a>。&lt;/p>
&lt;p>那么 Wowchemy 何以做到在其提供的有限几个 &lt;a href="#hugo-modules">Hugo modules&lt;/a> 的基础上不编写额外代码就可以产出这么多 templates？
内容网站还有一个十分常见的需求前面没有讲到，目录、摘要等等页面和完整具体的内容页面是有一些内容需要共享的，比如文章列表中也要展示：文章标题、发布时间等等，如何设计一种机制满足这类需求？&lt;/p>
&lt;p>Wowchemy 对于这些问题的答案就是 &lt;strong>blocks&lt;/strong>，这也是其在 Hugo 基础上提供的核心价值，所以 Wowchemy 现在也已经改名为 &lt;strong>Hugo blox&lt;/strong>。&lt;/p>
&lt;p>&lt;strong>blocks&lt;/strong> 是什么？&lt;/p>
&lt;p>在用户角度看，一个 block 就是 front matter 中某个列表的一员，内部包含一些字段，比如
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img src="./blocks.png" alt="" loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
这里有两个 block，它们的类型分别是 &lt;code>about.biography&lt;/code> 和 &lt;code>skills&lt;/code>。
我们只要按这个样子填写内容，最终生成的网页中，多个 block 会从上向下排列，&lt;a href="https://pxq.grokcv.ai/">本网站首页&lt;/a> 正是使用了这些 block。&lt;/p>
&lt;p>从功能设计来看，block 分为几个部分：&lt;/p>
&lt;ul>
&lt;li>配置：在 landing page 的 front matter 中配置 block&lt;/li>
&lt;li>内容：Hugo 根据上面的配置从其他内容文件中找到相关内容，比如 &lt;code>about.biography&lt;/code> 中的 username，Hugo 会用这个字段去 &lt;code>content/authors&lt;/code> 下查找对应的内容。&lt;/li>
&lt;li>展示：Hugo 根据上面的配置和找到的内容，按照 block 类型对应的 template 生成页面中这一块内容&lt;/li>
&lt;/ul>
&lt;p>
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img src="./blocks_1.png" alt="" loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
这是一个不严谨的举例，只是说明 block 的设计思路。&lt;/p>
&lt;p>因为我们团队所使用的两个 template: &lt;a href="#research-group--academic">Research Group &amp;amp; Academic&lt;/a> 都是基于 bootstrap 这个 Hugo module 来实现的。&lt;/p>
&lt;h3 id="bootstrap-module">bootstrap module&lt;/h3>
&lt;p>正如前面讲到，bootstrap 作为一个 Hugo module 是由 7 大组件构成。&lt;/p>
&lt;p>它实现的 archetype 包括 authors、post、event、publication 等等，后面讲模版 &lt;a href="#research-group">Research Group&lt;/a> 时会对这几种 archetype 作更多说明。&lt;/p>
&lt;p>它实现了一些常规 page template 之外，还有一个称为 &lt;strong>landing&lt;/strong> 的 template，这个 landing 就是由上面提到的 &lt;strong>blocks&lt;/strong> 组成。&lt;/p>
&lt;h4 id="blocks-in-bootstrap-module">Blocks in bootstrap module&lt;/h4>
&lt;p>这里介绍 bootstrap 中具有代表性的几个 block:&lt;/p>
&lt;ul>
&lt;li>markdown：完全自由的 markdown 语法&lt;/li>
&lt;li>skills：会从 &lt;code>content/authors&lt;/code> 中找到对应的 skills 字段进行展示&lt;/li>
&lt;li>collection：相对通用的 block，可以用来展示一些列表，比如文章列表等&lt;/li>
&lt;/ul>
&lt;p>关于这些 block 的详细使用方式可以参考个人子站源文件中的 &lt;code>content/_index.md&lt;/code>&lt;/p>
&lt;h2 id="research-group--academic">Research Group &amp;amp; Academic&lt;/h2>
&lt;p>前面讲了 Hugo 和 Wowchemy 的整体结构和一些概念的设计理由，到这里我们落地于具体的项目模板 &lt;a href="">Research Group&lt;/a> 和 &lt;a href="">Academic&lt;/a>，看看如何进行网站内容日常编辑。
这两个都是 Wowchemy 官方基于其几个常用 modules 提供的项目模版，也是在学术界比较常用的团队和个人模版，可以像 &lt;a href="">快速上线个人子站&lt;/a> 中提到的那样直接使用。&lt;/p>
&lt;h3 id="research-group">Research Group&lt;/h3>
&lt;p>我们团队网站 &lt;a href="https://grokcv.ai" target="_blank" rel="noopener">grokcv.ai&lt;/a> 正是使用了该模版。
关于这个模版，我们平时需要编辑的不多，只需要关注以下几项：&lt;/p>
&lt;ul>
&lt;li>添加你的信息&lt;/li>
&lt;li>新增 post&lt;/li>
&lt;li>新增 publication&lt;/li>
&lt;li>新增 event&lt;/li>
&lt;/ul>
&lt;h4 id="你的信息">你的信息&lt;/h4>
&lt;p>在该模版概念中，你是作为团队 authors 中的一员，所以你的个人信息这种内容的 archetype 是 &lt;code>authors&lt;/code>，生成对应的内容通过前面提到过的命令：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">hugo new content authors/yourname
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>会生成 &lt;code>content/authors/yourname&lt;/code> 目录作为你个人信息内容存放的目录，包含初始化的内容文件 &lt;code>_index.md&lt;/code>，接着修改该文件的 front matter 即可。&lt;/p>
&lt;h4 id="post">post&lt;/h4>
&lt;p>如果你有新的文章需要添加到团队网站，执行命令 &lt;code>hugo new content post/post-name&lt;/code> 即可。&lt;/p>
&lt;h4 id="publication">publication&lt;/h4>
&lt;p>和 post 类似：&lt;code>hugo new content publication/name&lt;/code>，增加了许多专业特性：PDF、Code、Dataset 等等。&lt;/p>
&lt;h4 id="event">event&lt;/h4>
&lt;p>新增命令 &lt;code>hugo new content event/name&lt;/code>，可将线上线下的一些活动日程公布在这里，也可以将活动演讲相关文件添加到此处。&lt;/p>
&lt;h3 id="academic">Academic&lt;/h3>
&lt;p>这个是你的个人子站使用的模版。&lt;/p>
&lt;div class="footnotes" role="doc-endnotes">
&lt;hr>
&lt;ol>
&lt;li id="fn:1">
&lt;p>我们团队的网站&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;li id="fn:2">
&lt;p>&lt;a href="https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-new-repository#creating-a-new-repository-from-a-url-query" target="_blank" rel="noopener">关于魔法链接&lt;/a>&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;li id="fn:3">
&lt;p>HTML、Javascript、CSS等文件是不变的，Web服务器只负责将这些文件返回给浏览器，服务端基本不执行代码来获取内容&amp;#160;&lt;a href="#fnref:3" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;li id="fn:4">
&lt;p>关于查找规则完整的说明可以查看&lt;a href="https://gohugo.io/content-management/archetypes/#lookup-order" target="_blank" rel="noopener">官方文档&lt;/a>&amp;#160;&lt;a href="#fnref:4" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&amp;#160;&lt;a href="#fnref1:4" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;li id="fn:5">
&lt;p>Hugo 是用 Go 语言实现的，所以直接使用 Go 语言的模版语法，具体&lt;a href="https://gohugo.io/templates/introduction/" target="_blank" rel="noopener">参考&lt;/a>&amp;#160;&lt;a href="#fnref:5" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;li id="fn:6">
&lt;p>可以参考 &lt;a href="https://linuxstory.org/why-never-use-git-submodule/" target="_blank" rel="noopener">为什么我不推荐你使用 git submodule&lt;/a>&amp;#160;&lt;a href="#fnref:6" class="footnote-backref" role="doc-backlink">&amp;#x21a9;&amp;#xfe0e;&lt;/a>&lt;/p>
&lt;/li>
&lt;/ol>
&lt;/div></description></item><item><title>Guide</title><link>https://pxq.grokcv.ai/post/guide/</link><pubDate>Sun, 03 Dec 2023 23:20:39 +0800</pubDate><guid>https://pxq.grokcv.ai/post/guide/</guid><description>&lt;ul>
&lt;li>Add post&lt;/li>
&lt;li>Add project&lt;/li>
&lt;li>Add talk&lt;/li>
&lt;li>Add publication&lt;/li>
&lt;li>Any other archetypes&lt;/li>
&lt;/ul></description></item><item><title>Blog with Jupyter Notebooks!</title><link>https://pxq.grokcv.ai/post/blog-with-jupyter/</link><pubDate>Sat, 04 Nov 2023 00:00:00 +0000</pubDate><guid>https://pxq.grokcv.ai/post/blog-with-jupyter/</guid><description>&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="kn">from&lt;/span> &lt;span class="nn">IPython.core.display&lt;/span> &lt;span class="kn">import&lt;/span> &lt;span class="n">Image&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">Image&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s1">&amp;#39;https://www.python.org/static/community_logos/python-logo-master-v3-TM-flattened.png&amp;#39;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="png" srcset="
/post/blog-with-jupyter/output_1_0_hu1e42f419f47ffd4b1ca9ef8f6670390a_11155_cdb6e311e2a1735dbf10e762428f706e.webp 400w,
/post/blog-with-jupyter/output_1_0_hu1e42f419f47ffd4b1ca9ef8f6670390a_11155_fc9bbb87927669af314bc8ac65d9d90e.webp 760w,
/post/blog-with-jupyter/output_1_0_hu1e42f419f47ffd4b1ca9ef8f6670390a_11155_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://pxq.grokcv.ai/post/blog-with-jupyter/output_1_0_hu1e42f419f47ffd4b1ca9ef8f6670390a_11155_cdb6e311e2a1735dbf10e762428f706e.webp"
width="601"
height="203"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">print&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s2">&amp;#34;Welcome to Academic!&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;pre>&lt;code>Welcome to Academic!
&lt;/code>&lt;/pre>
&lt;h2 id="organize-your-notebooks">Organize your notebooks&lt;/h2>
&lt;p>Place the notebooks that you would like to publish in a &lt;code>notebooks&lt;/code> folder at the root of your website.&lt;/p>
&lt;h2 id="import-the-notebooks-into-your-site">Import the notebooks into your site&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">pipx install academic
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">academic import &lt;span class="s1">&amp;#39;notebooks/**.ipynb&amp;#39;&lt;/span> content/post/ --verbose
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The notebooks will be published to the folder you specify above. In this case, they will be published to your &lt;code>content/post/&lt;/code> folder.&lt;/p></description></item><item><title>Welcome to Wowchemy, the website builder for Hugo</title><link>https://pxq.grokcv.ai/post/getting-started/</link><pubDate>Sun, 13 Dec 2020 00:00:00 +0000</pubDate><guid>https://pxq.grokcv.ai/post/getting-started/</guid><description>&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="kn">import&lt;/span> &lt;span class="nn">libr&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">print&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s1">&amp;#39;hello&amp;#39;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="overview">Overview&lt;/h2>
&lt;ol>
&lt;li>The Wowchemy website builder for Hugo, along with its starter templates, is designed for professional creators, educators, and teams/organizations - although it can be used to create any kind of site&lt;/li>
&lt;li>The template can be modified and customised to suit your needs. It&amp;rsquo;s a good platform for anyone looking to take control of their data and online identity whilst having the convenience to start off with a &lt;strong>no-code solution (write in Markdown and customize with YAML parameters)&lt;/strong> and having &lt;strong>flexibility to later add even deeper personalization with HTML and CSS&lt;/strong>&lt;/li>
&lt;li>You can work with all your favourite tools and apps with hundreds of plugins and integrations to speed up your workflows, interact with your readers, and much more&lt;/li>
&lt;/ol>
&lt;p>&lt;a href="https://wowchemy.com" target="_blank" rel="noopener">
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img src="https://raw.githubusercontent.com/wowchemy/wowchemy-hugo-modules/main/starters/academic/preview.png" alt="The template is mobile first with a responsive design to ensure that your site looks stunning on every device." loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/a>&lt;/p>
&lt;h2 id="get-started">Get Started&lt;/h2>
&lt;ul>
&lt;li>👉 &lt;a href="https://wowchemy.com/templates/" target="_blank" rel="noopener">&lt;strong>Create a new site&lt;/strong>&lt;/a>&lt;/li>
&lt;li>📚 &lt;a href="https://wowchemy.com/docs/" target="_blank" rel="noopener">&lt;strong>Personalize your site&lt;/strong>&lt;/a>&lt;/li>
&lt;li>💬 &lt;a href="https://discord.gg/z8wNYzb" target="_blank" rel="noopener">Chat with the &lt;strong>Wowchemy community&lt;/strong>&lt;/a> or &lt;a href="https://discourse.gohugo.io" target="_blank" rel="noopener">&lt;strong>Hugo community&lt;/strong>&lt;/a>&lt;/li>
&lt;li>🐦 Twitter: &lt;a href="https://twitter.com/wowchemy" target="_blank" rel="noopener">@wowchemy&lt;/a> &lt;a href="https://twitter.com/GeorgeCushen" target="_blank" rel="noopener">@GeorgeCushen&lt;/a> &lt;a href="https://twitter.com/search?q=%23MadeWithWowchemy&amp;amp;src=typed_query" target="_blank" rel="noopener">#MadeWithWowchemy&lt;/a>&lt;/li>
&lt;li>💡 &lt;a href="https://github.com/wowchemy/wowchemy-hugo-themes/issues" target="_blank" rel="noopener">Request a &lt;strong>feature&lt;/strong> or report a &lt;strong>bug&lt;/strong> for &lt;em>Wowchemy&lt;/em>&lt;/a>&lt;/li>
&lt;li>⬆️ &lt;strong>Updating Wowchemy?&lt;/strong> View the &lt;a href="https://wowchemy.com/docs/hugo-tutorials/update/" target="_blank" rel="noopener">Update Tutorial&lt;/a> and &lt;a href="https://wowchemy.com/updates/" target="_blank" rel="noopener">Release Notes&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="crowd-funded-open-source-software">Crowd-funded open-source software&lt;/h2>
&lt;p>To help us develop this template and software sustainably under the MIT license, we ask all individuals and businesses that use it to help support its ongoing maintenance and development via sponsorship.&lt;/p>
&lt;h3 id="-click-here-to-become-a-sponsor-and-help-support-wowchemys-future-httpswowchemycomsponsor">&lt;a href="https://wowchemy.com/sponsor/" target="_blank" rel="noopener">❤️ Click here to become a sponsor and help support Wowchemy&amp;rsquo;s future ❤️&lt;/a>&lt;/h3>
&lt;p>As a token of appreciation for sponsoring, you can &lt;strong>unlock &lt;a href="https://wowchemy.com/sponsor/" target="_blank" rel="noopener">these&lt;/a> awesome rewards and extra features 🦄✨&lt;/strong>&lt;/p>
&lt;h2 id="ecosystem">Ecosystem&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>&lt;a href="https://github.com/wowchemy/hugo-academic-cli" target="_blank" rel="noopener">Hugo Academic CLI&lt;/a>:&lt;/strong> Automatically import publications from BibTeX&lt;/li>
&lt;/ul>
&lt;h2 id="inspiration">Inspiration&lt;/h2>
&lt;p>&lt;a href="https://academic-demo.netlify.com/" target="_blank" rel="noopener">Check out the latest &lt;strong>demo&lt;/strong>&lt;/a> of what you&amp;rsquo;ll get in less than 10 minutes, or &lt;a href="https://wowchemy.com/user-stories/" target="_blank" rel="noopener">view the &lt;strong>showcase&lt;/strong>&lt;/a> of personal, project, and business sites.&lt;/p>
&lt;h2 id="features">Features&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>Page builder&lt;/strong> - Create &lt;em>anything&lt;/em> with &lt;a href="https://wowchemy.com/docs/page-builder/" target="_blank" rel="noopener">&lt;strong>widgets&lt;/strong>&lt;/a> and &lt;a href="https://wowchemy.com/docs/content/writing-markdown-latex/" target="_blank" rel="noopener">&lt;strong>elements&lt;/strong>&lt;/a>&lt;/li>
&lt;li>&lt;strong>Edit any type of content&lt;/strong> - Blog posts, publications, talks, slides, projects, and more!&lt;/li>
&lt;li>&lt;strong>Create content&lt;/strong> in &lt;a href="https://wowchemy.com/docs/content/writing-markdown-latex/" target="_blank" rel="noopener">&lt;strong>Markdown&lt;/strong>&lt;/a>, &lt;a href="https://wowchemy.com/docs/import/jupyter/" target="_blank" rel="noopener">&lt;strong>Jupyter&lt;/strong>&lt;/a>, or &lt;a href="https://wowchemy.com/docs/install-locally/" target="_blank" rel="noopener">&lt;strong>RStudio&lt;/strong>&lt;/a>&lt;/li>
&lt;li>&lt;strong>Plugin System&lt;/strong> - Fully customizable &lt;a href="https://wowchemy.com/docs/customization/" target="_blank" rel="noopener">&lt;strong>color&lt;/strong> and &lt;strong>font themes&lt;/strong>&lt;/a>&lt;/li>
&lt;li>&lt;strong>Display Code and Math&lt;/strong> - Code highlighting and &lt;a href="https://en.wikibooks.org/wiki/LaTeX/Mathematics" target="_blank" rel="noopener">LaTeX math&lt;/a> supported&lt;/li>
&lt;li>&lt;strong>Integrations&lt;/strong> - &lt;a href="https://analytics.google.com" target="_blank" rel="noopener">Google Analytics&lt;/a>, &lt;a href="https://disqus.com" target="_blank" rel="noopener">Disqus commenting&lt;/a>, Maps, Contact Forms, and more!&lt;/li>
&lt;li>&lt;strong>Beautiful Site&lt;/strong> - Simple and refreshing one page design&lt;/li>
&lt;li>&lt;strong>Industry-Leading SEO&lt;/strong> - Help get your website found on search engines and social media&lt;/li>
&lt;li>&lt;strong>Media Galleries&lt;/strong> - Display your images and videos with captions in a customizable gallery&lt;/li>
&lt;li>&lt;strong>Mobile Friendly&lt;/strong> - Look amazing on every screen with a mobile friendly version of your site&lt;/li>
&lt;li>&lt;strong>Multi-language&lt;/strong> - 34+ language packs including English, 中文, and Português&lt;/li>
&lt;li>&lt;strong>Multi-user&lt;/strong> - Each author gets their own profile page&lt;/li>
&lt;li>&lt;strong>Privacy Pack&lt;/strong> - Assists with GDPR&lt;/li>
&lt;li>&lt;strong>Stand Out&lt;/strong> - Bring your site to life with animation, parallax backgrounds, and scroll effects&lt;/li>
&lt;li>&lt;strong>One-Click Deployment&lt;/strong> - No servers. No databases. Only files.&lt;/li>
&lt;/ul>
&lt;h2 id="themes">Themes&lt;/h2>
&lt;p>Wowchemy and its templates come with &lt;strong>automatic day (light) and night (dark) mode&lt;/strong> built-in. Alternatively, visitors can choose their preferred mode - click the moon icon in the top right of the &lt;a href="https://academic-demo.netlify.com/" target="_blank" rel="noopener">Demo&lt;/a> to see it in action! Day/night mode can also be disabled by the site admin in &lt;code>params.toml&lt;/code>.&lt;/p>
&lt;p>&lt;a href="https://wowchemy.com/docs/customization" target="_blank" rel="noopener">Choose a stunning &lt;strong>theme&lt;/strong> and &lt;strong>font&lt;/strong>&lt;/a> for your site. Themes are fully customizable.&lt;/p>
&lt;h2 id="license">License&lt;/h2>
&lt;p>Copyright 2016-present &lt;a href="https://georgecushen.com" target="_blank" rel="noopener">George Cushen&lt;/a>.&lt;/p>
&lt;p>Released under the &lt;a href="https://github.com/wowchemy/wowchemy-hugo-themes/blob/master/LICENSE.md" target="_blank" rel="noopener">MIT&lt;/a> license.&lt;/p></description></item><item><title>Writing technical content in Markdown</title><link>https://pxq.grokcv.ai/post/writing-technical-content/</link><pubDate>Fri, 12 Jul 2019 00:00:00 +0000</pubDate><guid>https://pxq.grokcv.ai/post/writing-technical-content/</guid><description>&lt;p>Wowchemy is designed to give technical content creators a seamless experience. You can focus on the content and Wowchemy handles the rest.&lt;/p>
&lt;p>&lt;strong>Highlight your code snippets, take notes on math classes, and draw diagrams from textual representation.&lt;/strong>&lt;/p>
&lt;p>On this page, you&amp;rsquo;ll find some examples of the types of technical content that can be rendered with Wowchemy.&lt;/p>
&lt;h2 id="examples">Examples&lt;/h2>
&lt;h3 id="code">Code&lt;/h3>
&lt;p>Wowchemy supports a Markdown extension for highlighting code syntax. You can customize the styles under the &lt;code>syntax_highlighter&lt;/code> option in your &lt;code>config/_default/params.yaml&lt;/code> file.&lt;/p>
&lt;pre>&lt;code>```python
import pandas as pd
data = pd.read_csv(&amp;quot;data.csv&amp;quot;)
data.head()
```
&lt;/code>&lt;/pre>
&lt;p>renders as&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="kn">import&lt;/span> &lt;span class="nn">pandas&lt;/span> &lt;span class="k">as&lt;/span> &lt;span class="nn">pd&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">data&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">pd&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">read_csv&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s2">&amp;#34;data.csv&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">data&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">head&lt;/span>&lt;span class="p">()&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="mindmaps">Mindmaps&lt;/h3>
&lt;p>Wowchemy supports a Markdown extension for mindmaps.&lt;/p>
&lt;p>Simply insert a Markdown &lt;code>markmap&lt;/code> code block and optionally set the height of the mindmap as shown in the example below.&lt;/p>
&lt;p>A simple mindmap defined as a Markdown list:&lt;/p>
&lt;div class="highlight">
&lt;pre class="chroma">
&lt;code>
```markmap {height="200px"}
- Hugo Modules
- wowchemy
- wowchemy-plugins-netlify
- wowchemy-plugins-netlify-cms
- wowchemy-plugins-reveal
```
&lt;/code>
&lt;/pre>
&lt;/div>
&lt;p>renders as&lt;/p>
&lt;div class="markmap" style="height: 200px;">
&lt;pre>- Hugo Modules
- wowchemy
- wowchemy-plugins-netlify
- wowchemy-plugins-netlify-cms
- wowchemy-plugins-reveal&lt;/pre>
&lt;/div>
&lt;p>A more advanced mindmap with formatting, code blocks, and math:&lt;/p>
&lt;div class="highlight">
&lt;pre class="chroma">
&lt;code>
```markmap
- Mindmaps
- Links
- [Wowchemy Docs](https://wowchemy.com/docs/)
- [Discord Community](https://discord.gg/z8wNYzb)
- [GitHub](https://github.com/wowchemy/wowchemy-hugo-themes)
- Features
- Markdown formatting
- **inline** ~~text~~ *styles*
- multiline
text
- `inline code`
-
```js
console.log('hello');
console.log('code block');
```
- Math: $x = {-b \pm \sqrt{b^2-4ac} \over 2a}$
```
&lt;/code>
&lt;/pre>
&lt;/div>
&lt;p>renders as&lt;/p>
&lt;div class="markmap" style="height: 500px;">
&lt;pre>- Mindmaps
- Links
- [Wowchemy Docs](https://wowchemy.com/docs/)
- [Discord Community](https://discord.gg/z8wNYzb)
- [GitHub](https://github.com/wowchemy/wowchemy-hugo-themes)
- Features
- Markdown formatting
- **inline** ~~text~~ *styles*
- multiline
text
- `inline code`
-
```js
console.log('hello');
console.log('code block');
```
- Math: $x = {-b \pm \sqrt{b^2-4ac} \over 2a}$&lt;/pre>
&lt;/div>
&lt;h3 id="charts">Charts&lt;/h3>
&lt;p>Wowchemy supports the popular &lt;a href="https://plot.ly/" target="_blank" rel="noopener">Plotly&lt;/a> format for interactive charts.&lt;/p>
&lt;p>Save your Plotly JSON in your page folder, for example &lt;code>line-chart.json&lt;/code>, and then add the &lt;code>{{&amp;lt; chart data=&amp;quot;line-chart&amp;quot; &amp;gt;}}&lt;/code> shortcode where you would like the chart to appear.&lt;/p>
&lt;p>Demo:&lt;/p>
&lt;div id="chart-912487365" class="chart">&lt;/div>
&lt;script>
(function() {
let a = setInterval( function() {
if ( typeof window.Plotly === 'undefined' ) {
return;
}
clearInterval( a );
Plotly.d3.json("./line-chart.json", function(chart) {
Plotly.plot('chart-912487365', chart.data, chart.layout, {responsive: true});
});
}, 500 );
})();
&lt;/script>
&lt;p>You might also find the &lt;a href="http://plotly-json-editor.getforge.io/" target="_blank" rel="noopener">Plotly JSON Editor&lt;/a> useful.&lt;/p>
&lt;h3 id="math">Math&lt;/h3>
&lt;p>Wowchemy supports a Markdown extension for $\LaTeX$ math. You can enable this feature by toggling the &lt;code>math&lt;/code> option in your &lt;code>config/_default/params.yaml&lt;/code> file.&lt;/p>
&lt;p>To render &lt;em>inline&lt;/em> or &lt;em>block&lt;/em> math, wrap your LaTeX math with &lt;code>{{&amp;lt; math &amp;gt;}}$...${{&amp;lt; /math &amp;gt;}}&lt;/code> or &lt;code>{{&amp;lt; math &amp;gt;}}$$...$${{&amp;lt; /math &amp;gt;}}&lt;/code>, respectively. (We wrap the LaTeX math in the Wowchemy &lt;em>math&lt;/em> shortcode to prevent Hugo rendering our math as Markdown. The &lt;em>math&lt;/em> shortcode is new in v5.5-dev.)&lt;/p>
&lt;p>Example &lt;strong>math block&lt;/strong>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-latex" data-lang="latex">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">{{&lt;/span>&amp;lt; math &amp;gt;&lt;span class="nb">}}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="sb">$$&lt;/span>&lt;span class="nb">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">&lt;/span>&lt;span class="nv">\gamma&lt;/span>&lt;span class="nb">_{n} &lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="nv">\frac&lt;/span>&lt;span class="nb">{ &lt;/span>&lt;span class="nv">\left&lt;/span>&lt;span class="nb"> | &lt;/span>&lt;span class="nv">\left&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">\mathbf&lt;/span>&lt;span class="nb"> x_{n} &lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="nv">\mathbf&lt;/span>&lt;span class="nb"> x_{n&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="m">1&lt;/span>&lt;span class="nb">} &lt;/span>&lt;span class="nv">\right&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="o">)&lt;/span>&lt;span class="nb">^T &lt;/span>&lt;span class="nv">\left&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="o">[&lt;/span>&lt;span class="nv">\nabla&lt;/span>&lt;span class="nb"> F &lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">\mathbf&lt;/span>&lt;span class="nb"> x_{n}&lt;/span>&lt;span class="o">)&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="nv">\nabla&lt;/span>&lt;span class="nb"> F &lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">\mathbf&lt;/span>&lt;span class="nb"> x_{n&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="m">1&lt;/span>&lt;span class="nb">}&lt;/span>&lt;span class="o">)&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="nv">\right&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="o">]&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="nv">\right&lt;/span>&lt;span class="nb"> |}{&lt;/span>&lt;span class="nv">\left&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="nv">\|\nabla&lt;/span>&lt;span class="nb"> F&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">\mathbf&lt;/span>&lt;span class="nb">{x}_{n}&lt;/span>&lt;span class="o">)&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="nv">\nabla&lt;/span>&lt;span class="nb"> F&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">\mathbf&lt;/span>&lt;span class="nb">{x}_{n&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="m">1&lt;/span>&lt;span class="nb">}&lt;/span>&lt;span class="o">)&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="nv">\right&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="nv">\|&lt;/span>&lt;span class="nb">^&lt;/span>&lt;span class="m">2&lt;/span>&lt;span class="nb">}
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">&lt;/span>&lt;span class="s">$$&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">{{&lt;/span>&amp;lt; /math &amp;gt;&lt;span class="nb">}}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>renders as&lt;/p>
$$\gamma_{n} = \frac{ \left | \left (\mathbf x_{n} - \mathbf x_{n-1} \right )^T \left [\nabla F (\mathbf x_{n}) - \nabla F (\mathbf x_{n-1}) \right ] \right |}{\left \|\nabla F(\mathbf{x}_{n}) - \nabla F(\mathbf{x}_{n-1}) \right \|^2}$$
&lt;p>Example &lt;strong>inline math&lt;/strong> &lt;code>{{&amp;lt; math &amp;gt;}}$\nabla F(\mathbf{x}_{n})${{&amp;lt; /math &amp;gt;}}&lt;/code> renders as
$\nabla F(\mathbf{x}_{n})$.&lt;/p>
&lt;p>Example &lt;strong>multi-line math&lt;/strong> using the math linebreak (&lt;code>\\&lt;/code>):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-latex" data-lang="latex">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">{{&lt;/span>&amp;lt; math &amp;gt;&lt;span class="nb">}}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="sb">$$&lt;/span>&lt;span class="nb">f&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nb">k;p_{&lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="nb">}^{&lt;/span>&lt;span class="o">*&lt;/span>&lt;span class="nb">}&lt;/span>&lt;span class="o">)&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="nb"> &lt;/span>&lt;span class="nv">\begin&lt;/span>&lt;span class="nb">{cases}p_{&lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="nb">}^{&lt;/span>&lt;span class="o">*&lt;/span>&lt;span class="nb">} &amp;amp; &lt;/span>&lt;span class="nv">\text&lt;/span>&lt;span class="nb">{if }k&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="m">1&lt;/span>&lt;span class="nb">, &lt;/span>&lt;span class="nv">\\&lt;/span>&lt;span class="nb">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">&lt;/span>&lt;span class="m">1&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="nb">p_{&lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="nb">}^{&lt;/span>&lt;span class="o">*&lt;/span>&lt;span class="nb">} &amp;amp; &lt;/span>&lt;span class="nv">\text&lt;/span>&lt;span class="nb">{if }k&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="nb">.&lt;/span>&lt;span class="nv">\end&lt;/span>&lt;span class="nb">{cases}&lt;/span>&lt;span class="s">$$&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">{{&lt;/span>&amp;lt; /math &amp;gt;&lt;span class="nb">}}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>renders as&lt;/p>
$$
f(k;p_{0}^{*}) = \begin{cases}p_{0}^{*} &amp; \text{if }k=1, \\
1-p_{0}^{*} &amp; \text{if }k=0.\end{cases}
$$
&lt;h3 id="diagrams">Diagrams&lt;/h3>
&lt;p>Wowchemy supports a Markdown extension for diagrams. You can enable this feature by toggling the &lt;code>diagram&lt;/code> option in your &lt;code>config/_default/params.toml&lt;/code> file or by adding &lt;code>diagram: true&lt;/code> to your page front matter.&lt;/p>
&lt;p>An example &lt;strong>flowchart&lt;/strong>:&lt;/p>
&lt;pre>&lt;code>```mermaid
graph TD
A[Hard] --&amp;gt;|Text| B(Round)
B --&amp;gt; C{Decision}
C --&amp;gt;|One| D[Result 1]
C --&amp;gt;|Two| E[Result 2]
```
&lt;/code>&lt;/pre>
&lt;p>renders as&lt;/p>
&lt;div class="mermaid">graph TD
A[Hard] -->|Text| B(Round)
B --> C{Decision}
C -->|One| D[Result 1]
C -->|Two| E[Result 2]
&lt;/div>
&lt;p>An example &lt;strong>sequence diagram&lt;/strong>:&lt;/p>
&lt;pre>&lt;code>```mermaid
sequenceDiagram
Alice-&amp;gt;&amp;gt;John: Hello John, how are you?
loop Healthcheck
John-&amp;gt;&amp;gt;John: Fight against hypochondria
end
Note right of John: Rational thoughts!
John--&amp;gt;&amp;gt;Alice: Great!
John-&amp;gt;&amp;gt;Bob: How about you?
Bob--&amp;gt;&amp;gt;John: Jolly good!
```
&lt;/code>&lt;/pre>
&lt;p>renders as&lt;/p>
&lt;div class="mermaid">sequenceDiagram
Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!
&lt;/div>
&lt;p>An example &lt;strong>Gantt diagram&lt;/strong>:&lt;/p>
&lt;pre>&lt;code>```mermaid
gantt
section Section
Completed :done, des1, 2014-01-06,2014-01-08
Active :active, des2, 2014-01-07, 3d
Parallel 1 : des3, after des1, 1d
Parallel 2 : des4, after des1, 1d
Parallel 3 : des5, after des3, 1d
Parallel 4 : des6, after des4, 1d
```
&lt;/code>&lt;/pre>
&lt;p>renders as&lt;/p>
&lt;div class="mermaid">gantt
section Section
Completed :done, des1, 2014-01-06,2014-01-08
Active :active, des2, 2014-01-07, 3d
Parallel 1 : des3, after des1, 1d
Parallel 2 : des4, after des1, 1d
Parallel 3 : des5, after des3, 1d
Parallel 4 : des6, after des4, 1d
&lt;/div>
&lt;p>An example &lt;strong>class diagram&lt;/strong>:&lt;/p>
&lt;pre>&lt;code>```mermaid
classDiagram
Class01 &amp;lt;|-- AveryLongClass : Cool
Class03 *-- Class04
Class05 o-- Class06
Class07 .. Class08
Class09 --&amp;gt; C2 : Where am i?
Class09 --* C3
Class09 --|&amp;gt; Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
Class08 &amp;lt;--&amp;gt; C2: Cool label
```
&lt;/code>&lt;/pre>
&lt;p>renders as&lt;/p>
&lt;div class="mermaid">classDiagram
Class01 &lt;|-- AveryLongClass : Cool
Class03 *-- Class04
Class05 o-- Class06
Class07 .. Class08
Class09 --> C2 : Where am i?
Class09 --* C3
Class09 --|> Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
Class08 &lt;--> C2: Cool label
&lt;/div>
&lt;p>An example &lt;strong>state diagram&lt;/strong>:&lt;/p>
&lt;pre>&lt;code>```mermaid
stateDiagram
[*] --&amp;gt; Still
Still --&amp;gt; [*]
Still --&amp;gt; Moving
Moving --&amp;gt; Still
Moving --&amp;gt; Crash
Crash --&amp;gt; [*]
```
&lt;/code>&lt;/pre>
&lt;p>renders as&lt;/p>
&lt;div class="mermaid">stateDiagram
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]
&lt;/div>
&lt;h3 id="todo-lists">Todo lists&lt;/h3>
&lt;p>You can even write your todo lists in Markdown too:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-markdown" data-lang="markdown">&lt;span class="line">&lt;span class="cl">&lt;span class="k">- [x]&lt;/span> Write math example
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">- [x]&lt;/span> Write diagram example
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">- [ ]&lt;/span> Do something else
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>renders as&lt;/p>
&lt;ul>
&lt;li>&lt;input checked="" disabled="" type="checkbox"> Write math example
&lt;ul>
&lt;li>&lt;input checked="" disabled="" type="checkbox"> Write diagram example&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>&lt;input disabled="" type="checkbox"> Do something else&lt;/li>
&lt;/ul>
&lt;h3 id="tables">Tables&lt;/h3>
&lt;p>Save your spreadsheet as a CSV file in your page&amp;rsquo;s folder and then render it by adding the &lt;em>Table&lt;/em> shortcode to your page:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-go" data-lang="go">&lt;span class="line">&lt;span class="cl">&lt;span class="p">{{&amp;lt;&lt;/span> &lt;span class="nx">table&lt;/span> &lt;span class="nx">path&lt;/span>&lt;span class="p">=&lt;/span>&lt;span class="s">&amp;#34;results.csv&amp;#34;&lt;/span> &lt;span class="nx">header&lt;/span>&lt;span class="p">=&lt;/span>&lt;span class="s">&amp;#34;true&amp;#34;&lt;/span> &lt;span class="nx">caption&lt;/span>&lt;span class="p">=&lt;/span>&lt;span class="s">&amp;#34;Table 1: My results&amp;#34;&lt;/span> &lt;span class="p">&amp;gt;}}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>renders as&lt;/p>
&lt;table class="table">
&lt;tr> &lt;th>customer_id&lt;/th> &lt;th>score&lt;/th> &lt;/tr>
&lt;tr>
&lt;td data-table-dtype="number">1&lt;/td>
&lt;td data-table-dtype="number">0&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td data-table-dtype="number">2&lt;/td>
&lt;td data-table-dtype="text">0.5&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td data-table-dtype="number">3&lt;/td>
&lt;td data-table-dtype="number">1&lt;/td>
&lt;/tr>
&lt;caption>Table 1: My results&lt;/caption>
&lt;/table>
&lt;h3 id="callouts">Callouts&lt;/h3>
&lt;p>Academic supports a &lt;a href="https://wowchemy.com/docs/content/writing-markdown-latex/#callouts" target="_blank" rel="noopener">shortcode for callouts&lt;/a>, also referred to as &lt;em>asides&lt;/em>, &lt;em>hints&lt;/em>, or &lt;em>alerts&lt;/em>. By wrapping a paragraph in &lt;code>{{% callout note %}} ... {{% /callout %}}&lt;/code>, it will render as an aside.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-markdown" data-lang="markdown">&lt;span class="line">&lt;span class="cl">{{% callout note %}}
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">A Markdown aside is useful for displaying notices, hints, or definitions to your readers.
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">{{% /callout %}}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>renders as&lt;/p>
&lt;div class="alert alert-note">
&lt;div>
A Markdown aside is useful for displaying notices, hints, or definitions to your readers.
&lt;/div>
&lt;/div>
&lt;h3 id="spoilers">Spoilers&lt;/h3>
&lt;p>Add a spoiler to a page to reveal text, such as an answer to a question, after a button is clicked.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-markdown" data-lang="markdown">&lt;span class="line">&lt;span class="cl">{{&lt;span class="p">&amp;lt;&lt;/span> &lt;span class="nt">spoiler&lt;/span> &lt;span class="na">text&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s">&amp;#34;Click to view the spoiler&amp;#34;&lt;/span> &lt;span class="p">&amp;gt;&lt;/span>}}
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">You found me!
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">{{&lt;span class="p">&amp;lt;&lt;/span> &lt;span class="p">/&lt;/span>&lt;span class="nt">spoiler&lt;/span> &lt;span class="p">&amp;gt;&lt;/span>}}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>renders as&lt;/p>
&lt;details class="spoiler " id="spoiler-6">
&lt;summary>Click to view the spoiler&lt;/summary>
&lt;p>You found me!&lt;/p>
&lt;/details>
&lt;h3 id="icons">Icons&lt;/h3>
&lt;p>Academic enables you to use a wide range of &lt;a href="https://wowchemy.com/docs/getting-started/page-builder/#icons" target="_blank" rel="noopener">icons from &lt;em>Font Awesome&lt;/em> and &lt;em>Academicons&lt;/em>&lt;/a> in addition to &lt;a href="https://wowchemy.com/docs/content/writing-markdown-latex/#emojis" target="_blank" rel="noopener">emojis&lt;/a>.&lt;/p>
&lt;p>Here are some examples using the &lt;code>icon&lt;/code> shortcode to render icons:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-markdown" data-lang="markdown">&lt;span class="line">&lt;span class="cl">{{&lt;span class="p">&amp;lt;&lt;/span> &lt;span class="nt">icon&lt;/span> &lt;span class="na">name&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s">&amp;#34;terminal&amp;#34;&lt;/span> &lt;span class="na">pack&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s">&amp;#34;fas&amp;#34;&lt;/span> &lt;span class="p">&amp;gt;&lt;/span>}} Terminal
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">{{&lt;span class="p">&amp;lt;&lt;/span> &lt;span class="nt">icon&lt;/span> &lt;span class="na">name&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s">&amp;#34;python&amp;#34;&lt;/span> &lt;span class="na">pack&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s">&amp;#34;fab&amp;#34;&lt;/span> &lt;span class="p">&amp;gt;&lt;/span>}} Python
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">{{&lt;span class="p">&amp;lt;&lt;/span> &lt;span class="nt">icon&lt;/span> &lt;span class="na">name&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s">&amp;#34;r-project&amp;#34;&lt;/span> &lt;span class="na">pack&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s">&amp;#34;fab&amp;#34;&lt;/span> &lt;span class="p">&amp;gt;&lt;/span>}} R
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>renders as&lt;/p>
&lt;p>
&lt;i class="fas fa-terminal pr-1 fa-fw">&lt;/i> Terminal&lt;br>
&lt;i class="fab fa-python pr-1 fa-fw">&lt;/i> Python&lt;br>
&lt;i class="fab fa-r-project pr-1 fa-fw">&lt;/i> R&lt;/p>
&lt;h3 id="did-you-find-this-page-helpful-consider-sharing-it-">Did you find this page helpful? Consider sharing it 🙌&lt;/h3></description></item></channel></rss>