<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Pitfall on Nekonull's Garden</title><link>https://nekonull.me/en/tags/pitfall/</link><description>Recent content in Pitfall on Nekonull's Garden</description><generator>Hugo</generator><language>en-US</language><copyright>CC-BY-SA-4.0</copyright><lastBuildDate>Fri, 09 Apr 2021 17:10:00 +0300</lastBuildDate><atom:link href="https://nekonull.me/en/tags/pitfall/index.xml" rel="self" type="application/rss+xml"/><item><title>Code blocks within Markdown tables</title><link>https://nekonull.me/en/share/markdown-code-in-table/</link><pubDate>Fri, 09 Apr 2021 17:10:00 +0300</pubDate><guid>https://nekonull.me/en/share/markdown-code-in-table/</guid><description>&lt;p&gt;Markdown provides support for tables, but only basic text formatting (such as bold, italics, inline code, etc.) is supported within table cells. More complex text formatting, such as code blocks and horizontal lines, is not supported. If you need to add support for complex formatting within tables and you are using Github Flavored Markdown, one approach is to use HTML to define the table structure and then include inline Markdown text within it. Here is an example:&lt;/p&gt;
&lt;p&gt;Please note the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;&amp;lt;td&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;/td&amp;gt;&lt;/code&gt; tags for the corresponding table cells should be placed at the beginning of a new line (without any indentation).&lt;/li&gt;
&lt;li&gt;There should be a blank line between the Markdown text inside the table cell and the &lt;code&gt;&amp;lt;td&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;/td&amp;gt;&lt;/code&gt; tags.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt; Column 1 &lt;/td&gt; &lt;td&gt; Column 2 &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; Code Block &lt;/td&gt;
&lt;td&gt;
&lt;div class="td-code td-code--untitled" id="td-code-fb503455-fence-0" data-td-code data-td-code-auto-id
data-td-language="python" data-td-line-count="1"&gt;&lt;div class="td-code__utilities td-code__utilities--compact"&gt;
&lt;button class="td-code__copy" type="button" hidden data-td-code-copy
data-td-code-target="td-code-fb503455-fence-0" data-td-copy-mode="all"
data-td-label-copy="Copy code"
data-td-label-copied="Copied"
data-td-label-error="Copy failed"
aria-label="Copy code" title="Copy code"&gt;
&lt;i class="fa-regular fa-copy" aria-hidden="true"&gt;&lt;/i&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;div class="td-code__viewport" id="td-code-fb503455-fence-0-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;hello world&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;span class="visually-hidden" role="status" aria-live="polite" data-td-code-status&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; Horizontal Line &lt;/td&gt;
&lt;td&gt;
&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Some Text&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;Code: &lt;strong&gt;Note that the code block should end with 3 tildes&lt;/strong&gt; (I&amp;rsquo;m using two here because three would cause rendering errors and prematurely end the code block).&lt;/p&gt;
&lt;div class="td-code td-code--untitled" id="td-code-fb503455-fence-1" data-td-code data-td-code-auto-id
data-td-language="html" data-td-line-count="27"&gt;&lt;div class="td-code__utilities td-code__utilities--compact"&gt;
&lt;button class="td-code__copy" type="button" hidden data-td-code-copy
data-td-code-target="td-code-fb503455-fence-1" data-td-copy-mode="all"
data-td-label-copy="Copy code"
data-td-label-copied="Copied"
data-td-label-error="Copy failed"
aria-label="Copy code" title="Copy code"&gt;
&lt;i class="fa-regular fa-copy" aria-hidden="true"&gt;&lt;/i&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;div class="td-code__viewport" id="td-code-fb503455-fence-1-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;table&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;tr&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;td&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; Column 1 &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;td&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;td&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; Column 2 &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;td&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;tr&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;tr&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;td&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; Code Block &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;td&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;td&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!--line start--&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c"&gt;&amp;lt;!--empty line--&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;```python
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;print(&amp;#34;hello world&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;`` &lt;span class="c"&gt;&amp;lt;!--Should be 3 tilt here!--&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c"&gt;&amp;lt;!--empty line--&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;td&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!--line start--&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;tr&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;tr&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;td&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; Horizontal Line &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;td&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;td&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;**Markdown**
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Some Text
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;td&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;tr&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;table&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;span class="visually-hidden" role="status" aria-live="polite" data-td-code-status&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;p&gt;Reference link:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/a/60502719"&gt;https://stackoverflow.com/a/60502719&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Integrating Disqus with Hugo</title><link>https://nekonull.me/en/share/hugo-disqus/</link><pubDate>Sat, 03 Apr 2021 22:30:00 +0300</pubDate><guid>https://nekonull.me/en/share/hugo-disqus/</guid><description>&lt;p&gt;Hugo has built-in support for Disqus. In theory, you only need to set the &lt;code&gt;disqusShortname&lt;/code&gt; attribute at the top level of your site&amp;rsquo;s &lt;code&gt;config.toml&lt;/code&gt; file. However, there are some pitfalls when actually using it. Here are the specific steps.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Register your own account on the Disqus website.&lt;/li&gt;
&lt;li&gt;After logging in to the Disqus website, go to Settings in the upper right corner, then select Moderation on the left side. Here, create a new site, and the site name (&lt;code&gt;{site_name}.disqus.com&lt;/code&gt;) should be used as the value for &lt;code&gt;disqusShortname&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Once the site is created, choose the Free Plan on the Billing page.&lt;/li&gt;
&lt;li&gt;Set the &lt;code&gt;disqusShortname&lt;/code&gt; in the &lt;code&gt;config.toml&lt;/code&gt; file of Hugo.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Other minor issues:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;No comments displayed locally: In the theme&amp;rsquo;s &lt;code&gt;disqus.html&lt;/code&gt; file (located at &lt;code&gt;{site_folder}\themes\{theme_name}\layouts\partials\disqus.html&lt;/code&gt;), the comment box will not load when the condition (&lt;code&gt;indow.location.hostname == &amp;quot;localhost&amp;quot;&lt;/code&gt;) is met. If you need to debug, you can add a comment to this condition, and it will display normally locally.&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>