<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
    xmlns:atom="http://www.w3.org/2005/Atom"
    xmlns:webfeeds="http://webfeeds.org/rss/1.0">
    <channel>
        <title>Dong Liang's Blog</title>
        <atom:link href="https://upcoder.github.io/feed.xml" rel="self" type="application/rss+xml"/>
        <link>https://upcoder.github.io/</link>
        <description>A website with blog posts and pages</description>
        <pubDate>Sun, 10 Nov 2019 12:24:45 +0000</pubDate>
        <webfeeds:icon>https://upcoder.github.io/assets/img/triangle.png</webfeeds:icon>
        
        <item>
            
            <title>Sample post</title>
            <link>https://upcoder.github.io/2019/11/30/sample-post.html</link>
            <guid isPermaLink="false">/2019/11/30/sample-post.html</guid>
            <description>&lt;p&gt;Consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. 
Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. 
&lt;!--more--&gt;
Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Consectetur adipiscing elit&lt;/li&gt;
  &lt;li&gt;Donec a diam lectus&lt;/li&gt;
  &lt;li&gt;Sed sit amet ipsum mauris&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.&lt;/p&gt;

&lt;p&gt;Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula &lt;em&gt;semper consectetur sagittis&lt;/em&gt;, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/pexels/travel.jpeg&quot; alt=&quot;Travel&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Suspendisse lectus leo, consectetur in tempor sit amet, placerat quis neque&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Etiam luctus porttitor lorem, sed suscipit est rutrum non. Curabitur lobortis nisl a enim congue semper. Aenean commodo ultrices imperdiet. Vestibulum ut justo vel sapien venenatis tincidunt.&lt;/p&gt;

&lt;p&gt;Phasellus eget dolor sit amet ipsum dapibus condimentum vitae quis lectus. Aliquam ut massa in turpis dapibus convallis. Praesent elit lacus, vestibulum at malesuada et, ornare et est. Ut augue nunc, sodales ut euismod non, adipiscing vitae orci. Mauris ut placerat justo. Mauris in ultricies enim. Quisque nec est eleifend nulla ultrices egestas quis ut quam. Donec sollicitudin lectus a mauris pulvinar id aliquam urna cursus. Cras quis ligula sem, vel elementum mi. Phasellus non ullamcorper urna.&lt;/p&gt;
</description>
            <pubDate>Sat, 30 Nov 2019 00:00:00 +0000</pubDate>
        </item>
        
        <item>
            
                <enclosure length="1" type="image" url="https://upcoder.github.io/assets/img/thumbnails/DeeperClustering/flowchart.png"/>
            
            <title>Unsupervised Pre-training of Image Features on Non-Curated Data</title>
            <link>https://upcoder.github.io/2019/11/10/DeeperClustering.html</link>
            <guid isPermaLink="false">/2019/11/10/DeeperClustering.html</guid>
            <description>&lt;h1 id=&quot;unsupervised-pre-training-of-image-features-on-non-curated-data&quot;&gt;Unsupervised Pre-training of Image Features on Non-Curated Data&lt;/h1&gt;

&lt;h2 id=&quot;code--paper&quot;&gt;Code &amp;amp;&amp;amp; Paper&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/facebookresearch/DeeperCluster&quot;&gt;code, github&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1905.01278&quot;&gt;paper&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;名词解释&quot;&gt;名词解释&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;curated-data：整理过后的数据，一般不会存在类别不平衡现象，例如ImageNet，没有长尾分布。&lt;/li&gt;
  &lt;li&gt;如果按照监督信息的强弱排名的话：标记数据&amp;gt;无标记数据（curated data）&amp;gt;无标签数据（non-curated data）&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;问题定义&quot;&gt;问题定义&lt;/h2&gt;
&lt;h&gt;如何利用未整理的数据，训练一个pre-trained的模型参数，从而提高下游任务的性能？&lt;/h&gt;

&lt;h2 id=&quot;related-work&quot;&gt;Related Work&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Self-supervised learning&lt;/strong&gt;：利用另一个模型或者某些规则生成一个伪label(pseudo label)，基于这些pseudo label去优化我们的target network。&lt;script type=&quot;math/tex&quot;&gt;y_n&lt;/script&gt;代表的就是伪label
&lt;script type=&quot;math/tex&quot;&gt;min_{\theta , W}\frac{1}{N}\sum_{n=1}^N{l(g_W(f_{\theta}(x_n),y_n)}\\&lt;/script&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Clustering&lt;/strong&gt;：利用聚类算法的思想，生成label或者对应的feature representation。&lt;script type=&quot;math/tex&quot;&gt;z_n&lt;/script&gt;代表的是cluster的assignment。
&lt;script type=&quot;math/tex&quot;&gt;min_{\theta , W}\frac{1}{N}\sum_{n=1}^N{l(g_W(f_{\theta}(x_n),z_n)}\\
min_{C \in R^{dxk}}\frac{1}{N}\sum_{n=1}^N{min_{z_n\in\{0,1\}^k}||f_{\theta}(x_n)-C_{z_n}||_2^2}&lt;/script&gt;&lt;/li&gt;
  &lt;li&gt;对于self-supervised learning的方法来说，他对于数据的分布是相对稳定的，但是他不能捕捉图像之间的统计信息。但是对于Deep Clustering的方法来说，他对于数据的分布是不稳定的，不同的数据分布会导致不同的聚类效果。但是他可以考虑图像之间的统计信息。如下图所示&lt;/li&gt;
&lt;/ul&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: right&quot;&gt;Method&lt;/th&gt;
      &lt;th style=&quot;text-align: right&quot;&gt;inter-image statistics&lt;/th&gt;
      &lt;th style=&quot;text-align: right&quot;&gt;stable to distribution change&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;Self-Sup&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;N&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;Y&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;Deep Clustering&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;Y&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;N&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;deeperclustering&quot;&gt;DeeperClustering&lt;/h2&gt;
&lt;h3 id=&quot;idea&quot;&gt;idea&lt;/h3&gt;
&lt;p&gt;  上述我们分别介绍了Self-supervised 和 Clustering方法的优缺点，那么我们能不能考虑将两个方法结合起来呢。
  一种最直观的解决方案就是将两者的loss相加，但是作者认为如果相加的话，默认两个任务是相对独立的。
  为了让其有更多的相互影响，作者采用了笛卡尔乘积来将两者结合：
  &lt;script type=&quot;math/tex&quot;&gt;min_{\theta , W}\frac{1}{N}\sum_{n=1}^N{l(g_W(f_{\theta}(x_n),y_n \bigotimes z_n)}\\&lt;/script&gt;也就是将两者concat。&lt;/p&gt;

&lt;p&gt;  但是上述的笛卡尔乘积方式当某一个维度很长的时候，会造成latent space很大，所以为了解决该问题，作者提出了分层的DeeperClustering方法。&lt;/p&gt;

&lt;h3 id=&quot;overview&quot;&gt;overview&lt;/h3&gt;
&lt;p&gt;  网络结构如下所示，整个训练过程迭代的通过two-step来完成。&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;第一步：通过cluster生成pseudo label。这个过程是分级的，采用两级结构。首先我们通过kmeans对conv输出的特征进行聚类，聚成m类。
  然后我们利用self-sup的思想，对每个图像进行旋转0，90，180，270度，所以第一层在训练过程中有4m个class。
  我们再对每一个cluster内部再次进行聚类，聚类成K类。所以一共的类别是m*k类。&lt;/li&gt;
  &lt;li&gt;第二步：我们再通过生成的pseudo label进行学习与训练。
&lt;img src=&quot;https://upcoder.github.io/assets/img/thumbnails/DeeperClustering/flowchart.png&quot; alt=&quot;img&quot; /&gt;
    &lt;h3 id=&quot;loss-function&quot;&gt;Loss function&lt;/h3&gt;
    &lt;p&gt;  loss函数定义如下所示。总体上来说有两部分组成。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;&lt;script type=&quot;math/tex&quot;&gt;l(Vf_{\theta }(x_n), y_n)&lt;/script&gt;&lt;/strong&gt;代表的是第一级别的loss函数。一共是4m类，不仅仅有原来的m类，还有旋转后的，所以一共是4m类。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;&lt;script type=&quot;math/tex&quot;&gt;\sum_{s=1}^S{y_{ns}l(W_sf_{\theta }(x_n),z_n^s)}&lt;/script&gt;&lt;/strong&gt;代表的是第二级的loss。针对上述的4m类，每一类都有一个分类器，我们计算他的输出和二级聚类的label的loss。&lt;/li&gt;
&lt;/ul&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;\frac{1}{N}\sum_{n=1}^N{[l(Vf_{\theta }(x_n), y_n) + \sum_{s=1}^S{y_{ns}l(W_sf_{\theta }(x_n),z_n^s)}]}&lt;/script&gt;
</description>
            <pubDate>Sun, 10 Nov 2019 00:00:00 +0000</pubDate>
        </item>
        
        <item>
            
                <enclosure length="1" type="image" url="https://upcoder.github.io/assets/img/thumbnails/IIC/flowchart.png"/>
            
            <title>Invariant Information Clustering for Unsupervised Image Classification and Segmentation</title>
            <link>https://upcoder.github.io/2019/11/09/IIC.html</link>
            <guid isPermaLink="false">/2019/11/09/IIC.html</guid>
            <description>&lt;h1 id=&quot;invariant-information-clustering-for-unsupervised-image-classification-and-segmentation&quot;&gt;Invariant Information Clustering for Unsupervised Image Classification and Segmentation&lt;/h1&gt;

&lt;h2 id=&quot;code--paper&quot;&gt;Code &amp;amp;&amp;amp; Paper&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/xu-ji/IIC&quot;&gt;code, github&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://openaccess.thecvf.com/content_ICCV_2019/html/Ji_Invariant_Information_Clustering_for_Unsupervised_Image_Classification_and_Segmentation_ICCV_2019_paper.html&quot;&gt;paper&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;问题定义&quot;&gt;问题定义&lt;/h2&gt;
&lt;h&gt;如何基于无标签的数据，从头训练一个神经网络分类器？&lt;/h&gt;

&lt;h2 id=&quot;主要思想&quot;&gt;主要思想&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;利用paired的数据，通过最大化他们之间的互信息来优化整个分类器网络。&lt;/li&gt;
  &lt;li&gt;最大化互信息所代表的物理意义最大化已知一个数据的分布情况下，另一个数据分布减少的不确定性。也就是两个数据的相关性强。&lt;/li&gt;
  &lt;li&gt;如何生成paired的数据呢？通过augmentation的方式可以生成paired的数据。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;相关工作&quot;&gt;相关工作&lt;/h2&gt;
&lt;p&gt;作者介绍了在用无监督方式做聚类操作时候的相关工作。主要分为两类。&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;直接端到端的产生label的assignment。代表：&lt;a href=&quot;http://openaccess.thecvf.com/content_ECCV_2018/html/Mathilde_Caron_Deep_Clustering_for_ECCV_2018_paper.html&quot;&gt;DeepCluster&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;分为two-step，首先得到vector representation。然后再通过kmeans这种聚类算法得到label assignment。代表：&lt;a href=&quot;http://openaccess.thecvf.com/content_ICCVW_2019/html/ViRaL/Liang_Unsupervised_Teacher-Student_Model_for_Large-Scale_Video_Retrieval_ICCVW_2019_paper.html&quot;&gt;UTS&lt;/a&gt;
    &lt;h3 id=&quot;deepcluster-deep-clustering-for-unsupervised-learning-of-visual-features&quot;&gt;DeepCluster: Deep Clustering for Unsupervised Learning of Visual Features&lt;/h3&gt;
    &lt;ul&gt;
      &lt;li&gt;主要贡献是在学习vector representation的过程中结合的kmeans算法,流程图如下所示
&lt;img src=&quot;https://upcoder.github.io/assets/img/thumbnails/IIC/DeepClustering-flowchart.png&quot; alt=&quot;img&quot; /&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
  &lt;li&gt;优化的目标如下所示,可以看到如果按照如下目标优化的话，很有可能会出现极端情况的退化：所有的vector都是0，cluster也是0。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;script type=&quot;math/tex&quot;&gt;min_{\theta , W}\frac{1}{N}\sum_{n=1}^N{l(g_W(f_{\theta}(x_n),y_n)}\\
min_{C \in R^{dxk}}\frac{1}{N}\sum_{n=1}^N{min_{y_n\in\{0,1\}^k}||f_{\theta}(x_n)-C_{y_n}||_2^2}&lt;/script&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;所以为了避免这种情况出现，作者提出了一种reassign的结果的方案：也就是说当发现每一个cluster A为空的时候，我们就将非空cluster B的中心点加上一些随机噪声，将其作为A的中心点，然后重新assignment。&lt;/li&gt;
  &lt;li&gt;还有一个问题就是类别不平衡的问题。作者将其做了加权重的处理方式。
    &lt;h3 id=&quot;uts-unsupervised-teacher-student-model-for-large-scale-video-retrieval&quot;&gt;UTS: Unsupervised Teacher-Student Model for Large-Scale Video Retrieval&lt;/h3&gt;
  &lt;/li&gt;
  &lt;li&gt;本文主要是利用一种无监督的方式来提取特征，网络流程如下所示。
&lt;img src=&quot;https://upcoder.github.io/assets/img/thumbnails/IIC/UST-flowchart.png&quot; alt=&quot;img&quot; /&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;iic&quot;&gt;IIC&lt;/h2&gt;
&lt;h3 id=&quot;overview&quot;&gt;overview&lt;/h3&gt;
&lt;p&gt;网络结构如下所示，optional clustering代表的是可选的clustering。比如说，我们原有的只需要聚类10类，我们通过optional clustering可以选择聚100类。避免noise data的影响。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://upcoder.github.io/assets/img/thumbnails/IIC/flowchart.png&quot; alt=&quot;img&quot; /&gt;&lt;/p&gt;
&lt;h3 id=&quot;loss-function&quot;&gt;Loss function&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;我们知道互信息的定义为&lt;script type=&quot;math/tex&quot;&gt;I(X,Y)=\sum_{x \in X}\sum_{y \in Y}{p(x,y)log{\frac{p(x, y)}{p(x)p(y)}}}&lt;/script&gt;，所以我们需要分别计算关于X和Y的边缘概率分布和联合概率分布。
为了计算这两个分布，我们在batch范围内计算一个矩阵P，&lt;script type=&quot;math/tex&quot;&gt;P=\frac{1}{n}\sum_{i=1}^n{\Phi (x_i)\Phi ({x_i}^{'})^T}&lt;/script&gt;，其中&lt;script type=&quot;math/tex&quot;&gt;\Phi (x_i)&lt;/script&gt;代表的是分类器的输出，即就是每个class的概率。
在此基础上，我们可以计算I(z,z’),&lt;script type=&quot;math/tex&quot;&gt;I(z,z')=\sum_{c=1}^C{\sum_{c'=1}^C{P_{cc'}ln{\frac{P_{cc'}}{P_cP_{c'}}}}}&lt;/script&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;物理意义：互信息可以写成熵减去条件熵的形式：&lt;script type=&quot;math/tex&quot;&gt;I(z, z')=H(z)-H(z\|z')&lt;/script&gt;。最大化互信息，就代表着最大化熵，同时也代表着最小化条件熵。前者让每个cluster的概率尽可能相等，后者想要突出某个cluster的概率。所以有点对抗训练的意思。&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</description>
            <pubDate>Sat, 09 Nov 2019 00:00:00 +0000</pubDate>
        </item>
        
        <item>
            
                <enclosure length="1" type="image" url="https://upcoder.github.io/assets/img/thumbnails/desk-L1L2Norm.png"/>
            
            <title>为什么L1正则项产生稀疏的权重，L2正则项产生相对平滑的权重</title>
            <link>https://upcoder.github.io/2019/09/10/L2&L1.html</link>
            <guid isPermaLink="false">/2019/09/10/L2&L1.html</guid>
            <description>&lt;h1 id=&quot;l1和l2正则化的区别&quot;&gt;L1和L2正则化的区别&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;L1 和L2正则项的定义如下：
&lt;script type=&quot;math/tex&quot;&gt;L1 = \sum_{i} |w_i|\\
L2 = \sum_{i} (w_i)^2&lt;/script&gt;&lt;/li&gt;
  &lt;li&gt;首先我们先计算一下他们对应的导数，导入如下所示：
&lt;script type=&quot;math/tex&quot;&gt;\frac{\partial L1}{\partial w_i} = 1 or -1 \rightarrow w^{t+1}_i = w^t_i + \eta {(-1 or 1)}\\
\frac{\partial L2}{\partial w_i} = w_i \rightarrow w^{t+1}_i = w^t_i + \eta w_i&lt;/script&gt;&lt;/li&gt;
  &lt;li&gt;所以我们看到L1每次更新的时候会更新一个定值，那么若干次迭代之后，权重就有可能减少为0。但是L2每个更新的时候更新的值的大小和$w_i$ 的值是有关系的。当$w_i$ 趋近与0时，那么对应的导数值也会更新，所以他会不停的接近0，但并不会是0。此外，我们还可以得到，L2相对L1更稳定一些。&lt;/li&gt;
  &lt;li&gt;L1 产生0的权重也可以起到特征选择的作用，假设我们有$X_0…X_i…X_n$ n个特征，通过分配不同的权重$w_0…w_i…w_n$，然后使用L1 来做特征选择。因为我们使用L1正则，会比较偏向于将某些w设置为0，从而达到了特征选择的作用。&lt;/li&gt;
  &lt;li&gt;L2 可以迅速产生接近0的权值，但并不是0，所以会比较平滑。&lt;/li&gt;
  &lt;li&gt;此外，我们还可以从几何的角度来理解。
    &lt;ul&gt;
      &lt;li&gt;假设我们的Loss函数是$(y - wx)^2$, 那么我们的几何解释如下图所示：
  &lt;img src=&quot;https://vimsky.com/wp-content/uploads/2015/08/Screen-Shot-2015-08-26-at-21.56.02.png&quot; alt=&quot;img&quot; /&gt;&lt;/li&gt;
      &lt;li&gt;其中左图表示L1，右图表示L2。绿色代表的是loss的等高线，$w_1, w_2$ 在L1中的取值空间如左图的菱形所示。在L2中的取值空间如右图的圆形所示。从等高线和取值空间的交点可以看到L1更容易倾向一个权重偏大一个权重为0。L2更容易倾向权重都较小。&lt;/li&gt;
      &lt;li&gt;为什么等高线是类似圆形？以linear regression举例，我们的目标函数$E(w) = (y - w^Tx)^2$，可以看到E是关于w的平方函数，所以是类似圆形(椭圆形)。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://vimsky.com/article/969.html&quot;&gt;主要参考&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
            <pubDate>Tue, 10 Sep 2019 00:00:00 +0000</pubDate>
        </item>
        
        <item>
            
            <title>Color Post</title>
            <link>https://upcoder.github.io/2019/05/18/color-post.html</link>
            <guid isPermaLink="false">/2019/05/18/color-post.html</guid>
            <description>&lt;h1 id=&quot;what-a-colorful-post&quot;&gt;What a colorful post!&lt;/h1&gt;

&lt;p&gt;This is an idea that came from &lt;a href=&quot;https://github.com/xukimseven/HardCandy-Jekyll&quot;&gt;xukimseven/HardCandy-Jekyll&lt;/a&gt; 
looking at this cheerful and colorful them, I wanted to enable something similar for mine.&lt;/p&gt;

&lt;p&gt;You can go fork and star hers too! 😉&lt;/p&gt;

&lt;h2 id=&quot;how-does-it-work&quot;&gt;How does it work?&lt;/h2&gt;

&lt;p&gt;Basically you need to add just one thing, the color:&lt;/p&gt;

&lt;div class=&quot;language-yml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;post&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Color Post&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;brown&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It can either be a html color like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;brown&lt;/code&gt; (which look like red to me). Or with the rgb:&lt;/p&gt;

&lt;div class=&quot;language-yml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;post&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Color Post&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rgb(165,42,42)&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The background used is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;lineart.png&lt;/code&gt; from &lt;a href=&quot;https://github.com/xukimseven&quot;&gt;xukimseven&lt;/a&gt; you can edit it in the config file. 
If you want another one, put it in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/assets/img&lt;/code&gt; as well.&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;⚠️ It’s a bit hacking the css in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;post.html&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</description>
            <pubDate>Sat, 18 May 2019 00:00:00 +0000</pubDate>
        </item>
        
        <item>
            
                <enclosure length="1" type="image" url="https://upcoder.github.io/assets/img/thumbnails/desk-messy.jpeg"/>
            
            <title>Feature images</title>
            <link>https://upcoder.github.io/2014/11/29/feature-images.html</link>
            <guid isPermaLink="false">/2014/11/29/feature-images.html</guid>
            <description>&lt;p&gt;This is an example of a post which includes a feature image specified in the front matter of the post. The feature image spans the full-width of the page, and is shown with the title on permalink pages.&lt;/p&gt;

</description>
            <pubDate>Sat, 29 Nov 2014 00:00:00 +0000</pubDate>
        </item>
        
        <item>
            
            <title>Markdown and HTML</title>
            <link>https://upcoder.github.io/2014/11/28/markdown-and-html.html</link>
            <guid isPermaLink="false">/2014/11/28/markdown-and-html.html</guid>
            <description>&lt;p&gt;Jekyll supports the use of &lt;a href=&quot;http://daringfireball.net/projects/markdown/syntax&quot;&gt;Markdown&lt;/a&gt; with inline HTML tags which makes it easier to quickly write posts with Jekyll, without having to worry too much about text formatting. A sample of the formatting follows.&lt;/p&gt;

&lt;p&gt;Tables have also been extended from Markdown:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;First Header&lt;/th&gt;
      &lt;th&gt;Second Header&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Content Cell&lt;/td&gt;
      &lt;td&gt;Content Cell&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Content Cell&lt;/td&gt;
      &lt;td&gt;Content Cell&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;Here’s an example of an image, which is included using Markdown:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/img/pexels/book-glass.jpeg&quot; alt=&quot;Image of a glass on a book&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Highlighting for code in Jekyll is done using Base16 or Rouge. This theme makes use of Rouge by default.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// count to ten&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// count to twenty&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Type on Strap uses KaTeX to display maths. Equations such as &lt;script type=&quot;math/tex&quot;&gt;S_n = a \times \frac{1-r^n}{1-r}&lt;/script&gt; can be displayed inline.&lt;/p&gt;

&lt;p&gt;Alternatively, they can be shown on a new line:&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;f(x) = \int \frac{2x^2+4x+6}{x-2}&lt;/script&gt;
</description>
            <pubDate>Fri, 28 Nov 2014 00:00:00 +0000</pubDate>
        </item>
        
        <item>
            
            <title>What's your title</title>
            <link>https://upcoder.github.io/2014/11/27/whats-your-title.html</link>
            <guid isPermaLink="false">/2014/11/27/whats-your-title.html</guid>
            <description>&lt;p&gt;This is an example of a post which includes a feature image that has a
text, where you don’t want to redisplay the title.
We cannot simply set the title to the empty string, as that would
break pages that list this post, such as home and tags.&lt;/p&gt;

</description>
            <pubDate>Thu, 27 Nov 2014 00:00:00 +0000</pubDate>
        </item>
        
        <item>
            
            <title>Markup: Syntax Highlighting</title>
            <link>https://upcoder.github.io/2014/08/08/Markup-Syntax-Highlighting.html</link>
            <guid isPermaLink="false">/2014/08/08/Markup-Syntax-Highlighting.html</guid>
            <description>&lt;p&gt;From Michael’s Rose &lt;a href=&quot;https://mmistakes.github.io/minimal-mistakes/markup-syntax-highlighting&quot;&gt;Minimal Mistakes&lt;/a&gt;.
Syntax highlighting is a feature that displays source code, in different colors and fonts according to the category of terms. This feature facilitates writing in a structured language such as a programming language or a markup language as both structures and syntax errors are visually distinct. &lt;a href=&quot;http://en.wikipedia.org/wiki/Syntax_highlighting&quot;&gt;Highlighting&lt;/a&gt; does not affect the meaning of the text itself; it is intended only for human readers.&lt;/p&gt;

&lt;h3 id=&quot;gfm-code-blocks&quot;&gt;GFM Code Blocks&lt;/h3&gt;

&lt;p&gt;GitHub Flavored Markdown &lt;a href=&quot;https://help.github.com/articles/creating-and-highlighting-code-blocks/&quot;&gt;fenced code blocks&lt;/a&gt; are supported. To modify styling and highlight colors edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/_sass/syntax.scss&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-css highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;#container&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;-240px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;100%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-scss&quot; data-lang=&quot;scss&quot;&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nc&quot;&gt;.highlight&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1em&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$monospace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$type-size-7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;.8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;nav&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;pagination&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;role=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;navigation&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  {% if page.previous %}
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{{ site.url }}{{ page.previous.url }}&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;btn&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;title=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{{ page.previous.title }}&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Previous article&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
  {% endif %}
  {% if page.next %}
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{{ site.url }}{{ page.next.url }}&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;btn&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;title=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;{{ page.next.title }}&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Next article&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
  {% endif %}
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;&amp;lt;!-- /.pagination --&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Jekyll&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TagIndex&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Page&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;initialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;vi&quot;&gt;@site&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;
      &lt;span class=&quot;vi&quot;&gt;@base&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;base&lt;/span&gt;
      &lt;span class=&quot;vi&quot;&gt;@dir&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dir&lt;/span&gt;
      &lt;span class=&quot;vi&quot;&gt;@name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'index.html'&lt;/span&gt;
      &lt;span class=&quot;nb&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;vi&quot;&gt;@name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;nb&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;read_yaml&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;File&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'_layouts'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'tag_index.html'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;nb&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'tag'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tag&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;tag_title_prefix&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'tag_title_prefix'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Tagged: '&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;tag_title_suffix&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;site&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'tag_title_suffix'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&amp;amp;#8211;'&lt;/span&gt;
      &lt;span class=&quot;nb&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'title'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tag_title_prefix&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tag&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
      &lt;span class=&quot;nb&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'description'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;An archive of posts tagged &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tag&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;code-blocks-in-lists&quot;&gt;Code Blocks in Lists&lt;/h3&gt;

&lt;p&gt;Indentation matters. Be sure the indent of the code block aligns with the first non-space character after the list item marker (e.g., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1.&lt;/code&gt;). Usually this will mean indenting 3 spaces instead of 4.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Do step 1.&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Now do this:&lt;/p&gt;

    &lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;print_hi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Hi, &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;print_hi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Tom'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#=&amp;gt; prints 'Hi, Tom' to STDOUT.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;Now you can do this.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;github-gist-embed&quot;&gt;GitHub Gist Embed&lt;/h3&gt;

&lt;p&gt;An example of a Gist embed below.&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/mmistakes/77c68fbb07731a456805a7b473f47841.js&quot;&gt;&lt;/script&gt;

&lt;h3 id=&quot;source&quot;&gt;Source&lt;/h3&gt;

</description>
            <pubDate>Fri, 08 Aug 2014 00:00:00 +0000</pubDate>
        </item>
        
        <item>
            
            <title>Generate a table of content</title>
            <link>https://upcoder.github.io/2013/12/12/Generate-a-table-of-content.html</link>
            <guid isPermaLink="false">/2013/12/12/Generate-a-table-of-content.html</guid>
            <description>&lt;p&gt;Test article, get the source on &lt;a href=&quot;https://github.com/Sylhare/Type-on-Strap/blob/gh-pages/_posts/2013-12-12-toc.js-for-table-of-content.md&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;

&lt;h1 id=&quot;using-kramdown-gfm&quot;&gt;Using Kramdown GFM&lt;/h1&gt;

&lt;!-- To be placed at the beginning of the post, it is where the table of content will be generated --&gt;
&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#using-kramdown-gfm&quot; id=&quot;markdown-toc-using-kramdown-gfm&quot;&gt;Using Kramdown GFM&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#basic-usage&quot; id=&quot;markdown-toc-basic-usage&quot;&gt;Basic Usage&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#using-tocjs&quot; id=&quot;markdown-toc-using-tocjs&quot;&gt;Using toc.js&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#customize-with-tocjs&quot; id=&quot;markdown-toc-customize-with-tocjs&quot;&gt;Customize with toc.js&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#use-with-this-jekyll-template&quot; id=&quot;markdown-toc-use-with-this-jekyll-template&quot;&gt;Use with this jekyll template&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#basic-usage-1&quot; id=&quot;markdown-toc-basic-usage-1&quot;&gt;Basic Usage&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#how-it-would-look-like&quot; id=&quot;markdown-toc-how-it-would-look-like&quot;&gt;How it would look like&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;basic-usage&quot;&gt;Basic Usage&lt;/h2&gt;

&lt;p&gt;You need to put this at the beginning of the page where you want the table of content to be displayed&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;* TOC
{:toc}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It will then render the markdown and html titles (lines that begins with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#&lt;/code&gt; or using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;h1&amp;gt;&amp;lt;/h1&amp;gt;&lt;/code&gt; tages)&lt;/p&gt;

&lt;h1 id=&quot;using-tocjs&quot;&gt;Using toc.js&lt;/h1&gt;

&lt;p&gt;Demo display of &lt;a href=&quot;https://github.com/ghiculescu/jekyll-table-of-contents&quot;&gt;jekyll-table-of-contents&lt;/a&gt; by ghiculescu.&lt;/p&gt;

&lt;!-- To be placed at the beginning of the post, it is where the table of content will be generated --&gt;
&lt;div id=&quot;toc&quot;&gt;&lt;/div&gt;

&lt;h2 id=&quot;customize-with-tocjs&quot;&gt;Customize with toc.js&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/ghiculescu/jekyll-table-of-contents&quot;&gt;toc.js&lt;/a&gt; stands for table of content, it is a js plugin that generates automatically a table of content of a post.&lt;/p&gt;

&lt;h3 id=&quot;use-with-this-jekyll-template&quot;&gt;Use with this jekyll template&lt;/h3&gt;

&lt;p&gt;If you want to customize the theme it is up to you, you can add the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;toc.js&lt;/code&gt; file into the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;asset &amp;gt; js&lt;/code&gt; and add it into the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;page.html&lt;/code&gt; layout with:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/assets/js/toc.js&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Then you can use it as it is said on the repository.&lt;/p&gt;

&lt;h2 id=&quot;basic-usage-1&quot;&gt;Basic Usage&lt;/h2&gt;

&lt;p&gt;The script requires jQuery. First, reference toc.js in templates where you would like to add the table of content. Then, create an HTML element wherever you want your table of contents to appear:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;toc&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then you put your post with titles and all like:&lt;/p&gt;

&lt;div class=&quot;language-apiblueprint highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;gu&quot;&gt;## Title&lt;/span&gt;
&lt;span class=&quot;gu&quot;&gt;## Mid title 1&lt;/span&gt;
This is text on page one
&lt;span class=&quot;gu&quot;&gt;## Mid title 2&lt;/span&gt;
This is text for page two
&lt;span class=&quot;gu&quot;&gt;### Sub title 2.a&lt;/span&gt;
Some more text
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then at the end of your post, you call the .toc() function using:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ready&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;#toc&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;toc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;how-it-would-look-like&quot;&gt;How it would look like&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/20642750/39189661-c22099f2-47a0-11e8-826e-2ec3ef4cc4f4.png&quot; alt=&quot;image&quot; /&gt;&lt;/p&gt;

&lt;script&gt;
// toc.js 
// Copied here for the example, can be placed in assets/js for real use in your template.
// https://github.com/ghiculescu/jekyll-table-of-contents
(function($){
  $.fn.toc = function(options) {
    var defaults = {
      noBackToTopLinks: false,
      title: '&lt;i&gt;Jump to...&lt;/i&gt;',
      minimumHeaders: 3,
      headers: 'h1, h2, h3, h4, h5, h6',
      listType: 'ol', // values: [ol|ul]
      showEffect: 'show', // values: [show|slideDown|fadeIn|none]
      showSpeed: 'slow', // set to 0 to deactivate effect
      classes: { list: '',
                 item: ''
               }
    },
    settings = $.extend(defaults, options);

    function fixedEncodeURIComponent (str) {
      return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
        return '%' + c.charCodeAt(0).toString(16);
      });
    }

    function createLink (header) {
      var innerText = (header.textContent === undefined) ? header.innerText : header.textContent;
      return &quot;&lt;a href='#&quot; + fixedEncodeURIComponent(header.id) + &quot;'&gt;&quot; + innerText + &quot;&lt;/a&gt;&quot;;
    }

    var headers = $(settings.headers).filter(function() {
      // get all headers with an ID
      var previousSiblingName = $(this).prev().attr( &quot;name&quot; );
      if (!this.id &amp;&amp; previousSiblingName) {
        this.id = $(this).attr( &quot;id&quot;, previousSiblingName.replace(/\./g, &quot;-&quot;) );
      }
      return this.id;
    }), output = $(this);
    if (!headers.length || headers.length &lt; settings.minimumHeaders || !output.length) {
      $(this).hide();
      return;
    }

    if (0 === settings.showSpeed) {
      settings.showEffect = 'none';
    }

    var render = {
      show: function() { output.hide().html(html).show(settings.showSpeed); },
      slideDown: function() { output.hide().html(html).slideDown(settings.showSpeed); },
      fadeIn: function() { output.hide().html(html).fadeIn(settings.showSpeed); },
      none: function() { output.html(html); }
    };

    var get_level = function(ele) { return parseInt(ele.nodeName.replace(&quot;H&quot;, &quot;&quot;), 10); };
    var highest_level = headers.map(function(_, ele) { return get_level(ele); }).get().sort()[0];
    var return_to_top = '&lt;i class=&quot;icon-arrow-up back-to-top&quot;&gt; &lt;/i&gt;';

    var level = get_level(headers[0]),
      this_level,
      html = settings.title + &quot; &lt;&quot; +settings.listType + &quot; class=\&quot;&quot; + settings.classes.list +&quot;\&quot;&gt;&quot;;
    headers.on('click', function() {
      if (!settings.noBackToTopLinks) {
        window.location.hash = this.id;
      }
    })
    .addClass('clickable-header')
    .each(function(_, header) {
      this_level = get_level(header);
      if (!settings.noBackToTopLinks &amp;&amp; this_level === highest_level) {
        $(header).addClass('top-level-header').after(return_to_top);
      }
      if (this_level === level) // same level as before; same indenting
        html += &quot;&lt;li class=\&quot;&quot; + settings.classes.item + &quot;\&quot;&gt;&quot; + createLink(header);
      else if (this_level &lt;= level){ // higher level than before; end parent ol
        for(var i = this_level; i &lt; level; i++) {
          html += &quot;&lt;/li&gt;&lt;/&quot;+settings.listType+&quot;&gt;&quot;
        }
        html += &quot;&lt;li class=\&quot;&quot; + settings.classes.item + &quot;\&quot;&gt;&quot; + createLink(header);
      }
      else if (this_level &gt; level) { // lower level than before; expand the previous to contain a ol
        for(i = this_level; i &gt; level; i--) {
          html += &quot;&lt;&quot; + settings.listType + &quot; class=\&quot;&quot; + settings.classes.list +&quot;\&quot;&gt;&quot; +
                  &quot;&lt;li class=\&quot;&quot; + settings.classes.item + &quot;\&quot;&gt;&quot;
        }
        html += createLink(header);
      }
      level = this_level; // update for the next one
    });
    html += &quot;&lt;/&quot;+settings.listType+&quot;&gt;&quot;;
    if (!settings.noBackToTopLinks) {
      $(document).on('click', '.back-to-top', function() {
        $(window).scrollTop(0);
        window.location.hash = '';
      });
    }

    render[settings.showEffect]();
  };
})(jQuery);
&lt;/script&gt;

&lt;!-- To be copied at the end of the post to render the table of content --&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() {
    $('#toc').toc();
});
&lt;/script&gt;

</description>
            <pubDate>Thu, 12 Dec 2013 00:00:00 +0000</pubDate>
        </item>
        
        <item>
            
            <title>Blogging with title</title>
            <link>https://upcoder.github.io/2013/11/18/blogging-with-title.html</link>
            <guid isPermaLink="false">/2013/11/18/blogging-with-title.html</guid>
            <description>&lt;h1 id=&quot;i-am-a-big-title&quot;&gt;I am a BIG title&lt;/h1&gt;

&lt;p&gt;This is a very tiny tiny post with less than 250 letters.&lt;/p&gt;

&lt;p&gt;Search should be working even for complicated escape symbols&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sed -i 's/\&quot;hostname\&quot;\:.*$/\&quot;hostname\&quot;\: \&quot;'$IPADDR'\&quot;\,/g' open-falcon/agent/config/cfg.json
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
            <pubDate>Mon, 18 Nov 2013 00:00:00 +0000</pubDate>
        </item>
        
    </channel>
</rss>