<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="atom.xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <id>https://zh-impact.github.io/blog</id>
    <title>Zed 的开发日记 Blog</title>
    <updated>2026-02-13T00:00:00.000Z</updated>
    <generator>https://github.com/jpmonette/feed</generator>
    <link rel="alternate" href="https://zh-impact.github.io/blog"/>
    <subtitle>Zed 的开发日记 Blog</subtitle>
    <icon>https://zh-impact.github.io/img/favicon.ico</icon>
    <entry>
        <title type="html"><![CDATA[Shell Config in AI era]]></title>
        <id>https://zh-impact.github.io/blog/shell-config</id>
        <link href="https://zh-impact.github.io/blog/shell-config"/>
        <updated>2026-02-13T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[几年前，我曾在公司内部分享过 zsh 配置的经验。现在，到了 AI 时代，各种 AI 工具如 Claude、Cursor、Windsurf 等，疯狂的在 home 中加入大量的配置。]]></summary>
        <content type="html"><![CDATA[<p>几年前，我曾在公司内部分享过 zsh 配置的经验。现在，到了 AI 时代，各种 AI 工具如 Claude、Cursor、Windsurf 等，疯狂的在 home 中加入大量的配置。</p>
<p>这些配置是干什么的？有什么用？为什么有时候没有生效？</p>
<p>现在，让我们一起探索一下。Shell Config 的各种细节。</p>]]></content>
        <author>
            <name>Zed</name>
            <uri>https://github.com/zh-impact</uri>
        </author>
        <category label="Shell" term="Shell"/>
        <category label="AI" term="AI"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[MDX Blog Post]]></title>
        <id>https://zh-impact.github.io/blog/mdx-blog-post</id>
        <link href="https://zh-impact.github.io/blog/mdx-blog-post"/>
        <updated>2021-08-01T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Blog posts support Docusaurus Markdown features, such as MDX.]]></summary>
        <content type="html"><![CDATA[<p>Blog posts support <a href="https://docusaurus.io/docs/markdown-features" target="_blank" rel="noopener noreferrer" class="">Docusaurus Markdown features</a>, such as <a href="https://mdxjs.com/" target="_blank" rel="noopener noreferrer" class="">MDX</a>.</p>
<div class="theme-admonition theme-admonition-tip admonition_qcFn alert alert--success"><div class="admonitionHeading_QbIs"><span class="admonitionIcon_Yvg2"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_njgP"><p>Use the power of React to create interactive blog posts.</p></div></div>
<!-- -->
<p>For example, use JSX to create an interactive button:</p>
<div class="language-js codeBlockContainer_OmDh theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_JSae"><pre tabindex="0" class="prism-code language-js codeBlock_yp_n thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines__fVw"><span class="token-line" style="color:#393A34"><span class="token operator" style="color:#393A34">&lt;</span><span class="token plain">button onClick</span><span class="token operator" style="color:#393A34">=</span><span class="token punctuation" style="color:#393A34">{</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=&gt;</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">alert</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'button clicked!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">&gt;</span><span class="token maybe-class-name">Click</span><span class="token plain"> me</span><span class="token operator" style="color:#393A34">!</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">button</span><span class="token operator" style="color:#393A34">&gt;</span><br></span></code></pre></div></div>
<button>Click me!</button>]]></content>
        <author>
            <name>Sébastien Lorber</name>
            <uri>https://sebastienlorber.com</uri>
        </author>
        <category label="Docusaurus" term="Docusaurus"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[如何像 styled-components 一样使用样式]]></title>
        <id>https://zh-impact.github.io/blog/constructable-stylesheet</id>
        <link href="https://zh-impact.github.io/blog/constructable-stylesheet"/>
        <updated>2020-09-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[不知道大家有没有遇到过这种情况：当访问一个用了 styled-components 技术的网站，打开开发者工具，想要修改下样式的时候，发现有些样式修改不了（注：chrome 更新后可以修改了，现在主要介绍下这项技术）。]]></summary>
        <content type="html"><![CDATA[<p>不知道大家有没有遇到过这种情况：当访问一个用了 styled-components 技术的网站，打开开发者工具，想要修改下样式的时候，发现有些样式修改不了（注：chrome 更新后可以修改了，现在主要介绍下这项技术）。</p>
<p>这里拿 styled-components 官网作为例子展示下效果：
<img decoding="async" loading="lazy" alt="styled-components" src="https://zh-impact.github.io/assets/images/styled-components-38d461908fe079f2f1dab55183bd5f60.png" width="1905" height="1924" class="img_ci_5"></p>
<p>可以在控制台样式区域，看到如图由 styled-componets 生成的 class 名称对应的样式是不可以编辑的。看到这个情况，我的好奇心就被勾起来了。随着一步步的探索实验，最终破解了这个谜团。下面来还原破案过程。</p>
<h2 class="anchor anchorTargetStickyNavbar_Vl44" id="破案步骤">破案步骤<a href="https://zh-impact.github.io/blog/constructable-stylesheet#%E7%A0%B4%E6%A1%88%E6%AD%A5%E9%AA%A4" class="hash-link" aria-label="Direct link to 破案步骤" title="Direct link to 破案步骤" translate="no">​</a></h2>
<p>当点击样式规则右上角，准备追溯来源时，跳转到了一个没有内容的 style 标签。<code>&lt;style data-styled="active" data-styled-version="5.1.0"&gt;&lt;/style&gt;</code></p>
<p>记得以前看到过 js 操作样式表的 API，于是在 MDN 上搜索相关 API, 没有看到直接创建样式的接口。但发现了一行文字: <code>Constructable Stylesheet Objects</code>. 并且 MDN 上说到 Blink 平台早已支持该 API.</p>
<p>使用示例</p>
<div class="language-javascript codeBlockContainer_OmDh theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_JSae"><pre tabindex="0" class="prism-code language-javascript codeBlock_yp_n thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines__fVw"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> mySheet </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CSSStyleSheet</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">mySheet</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRule</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'h2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'color: red'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token dom variable" style="color:#36acaa">document</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">adoptedStyleSheets</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">mySheet</span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre></div></div>
<p><a href="https://developer.mozilla.org/zh-CN/docs/Web/API/CSSStyleSheet" target="_blank" rel="noopener noreferrer" class="">参考</a>
<a href="https://wicg.github.io/construct-stylesheets/" target="_blank" rel="noopener noreferrer" class="">参考</a></p>]]></content>
        <author>
            <name>Zed</name>
            <uri>https://github.com/zh-impact</uri>
        </author>
        <category label="Frontend" term="Frontend"/>
        <category label="CSS" term="CSS"/>
        <category label="Styled Components" term="Styled Components"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[When to Use Static Generation v.s. Server-side Rendering]]></title>
        <id>https://zh-impact.github.io/blog/ssr-ssg</id>
        <link href="https://zh-impact.github.io/blog/ssr-ssg"/>
        <updated>2020-01-02T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[We recommend using Static Generation (with and without data) whenever possible because your page can be built once and served by CDN, which makes it much faster than having a server render the page on every request.]]></summary>
        <content type="html"><![CDATA[<p>We recommend using <strong>Static Generation</strong> (with and without data) whenever possible because your page can be built once and served by CDN, which makes it much faster than having a server render the page on every request.</p>
<p>You can use Static Generation for many types of pages, including:</p>
<ul>
<li class="">Marketing pages</li>
<li class="">Blog posts</li>
<li class="">E-commerce product listings</li>
<li class="">Help and documentation</li>
</ul>
<p>You should ask yourself: "Can I pre-render this page <strong>ahead</strong> of a user's request?" If the answer is yes, then you should choose Static Generation.</p>
<p>On the other hand, Static Generation is <strong>not</strong> a good idea if you cannot pre-render a page ahead of a user's request. Maybe your page shows frequently updated data, and the page content changes on every request.</p>
<p>In that case, you can use <strong>Server-Side Rendering</strong>. It will be slower, but the pre-rendered page will always be up-to-date. Or you can skip pre-rendering and use client-side JavaScript to populate data.</p>]]></content>
        <author>
            <name>Zed</name>
            <uri>https://github.com/zh-impact</uri>
        </author>
        <category label="Frontend" term="Frontend"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Pre-rendering]]></title>
        <id>https://zh-impact.github.io/blog/pre-rendering</id>
        <link href="https://zh-impact.github.io/blog/pre-rendering"/>
        <updated>2020-01-01T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Next.js has two forms of pre-rendering: Static Generation and Server-side Rendering. The difference is in when it generates the HTML for a page.]]></summary>
        <content type="html"><![CDATA[<p>Next.js has two forms of pre-rendering: <strong>Static Generation</strong> and <strong>Server-side Rendering</strong>. The difference is in <strong>when</strong> it generates the HTML for a page.</p>
<ul>
<li class=""><strong>Static Generation</strong> is the pre-rendering method that generates the HTML at <strong>build time</strong>. The pre-rendered HTML is then <em>reused</em> on each request.</li>
<li class=""><strong>Server-side Rendering</strong> is the pre-rendering method that generates the HTML on <strong>each request</strong>.</li>
</ul>
<p>Importantly, Next.js lets you <strong>choose</strong> which pre-rendering form to use for each page. You can create a "hybrid" Next.js app by using Static Generation for most pages and using Server-side Rendering for others.</p>]]></content>
        <author>
            <name>Zed</name>
            <uri>https://github.com/zh-impact</uri>
        </author>
        <category label="Frontend" term="Frontend"/>
        <category label="Next.js" term="Next.js"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Long Blog Post]]></title>
        <id>https://zh-impact.github.io/blog/long-blog-post</id>
        <link href="https://zh-impact.github.io/blog/long-blog-post"/>
        <updated>2019-05-29T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[This is the summary of a very long blog post,]]></summary>
        <content type="html"><![CDATA[<p>This is the summary of a very long blog post,</p>
<p>Use a <code>&lt;!--</code> <code>truncate</code> <code>--&gt;</code> comment to limit blog post size in the list view.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>]]></content>
        <author>
            <name>Yangshun Tay</name>
            <uri>https://linkedin.com/in/yangshun</uri>
        </author>
        <category label="Hello" term="Hello"/>
        <category label="Docusaurus" term="Docusaurus"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[First Blog Post]]></title>
        <id>https://zh-impact.github.io/blog/first-blog-post</id>
        <link href="https://zh-impact.github.io/blog/first-blog-post"/>
        <updated>2019-05-28T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Lorem ipsum dolor sit amet...]]></summary>
        <content type="html"><![CDATA[<p>Lorem ipsum dolor sit amet...</p>
<p>...consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet</p>]]></content>
        <author>
            <name>Sébastien Lorber</name>
            <uri>https://sebastienlorber.com</uri>
        </author>
        <author>
            <name>Yangshun Tay</name>
            <uri>https://linkedin.com/in/yangshun</uri>
        </author>
        <category label="Hola" term="Hola"/>
        <category label="Docusaurus" term="Docusaurus"/>
    </entry>
</feed>