<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/scripts/pretty-feed-v3.xsl" type="text/xsl"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:h="http://www.w3.org/TR/html4/"><channel><title>Zikai‘s Blog</title><description>Stay hungry, stay foolish</description><link>https://astro-pure.js.org</link><item><title>brain2模块笔记</title><link>https://astro-pure.js.org/blog/brain2_note/brain2_note</link><guid isPermaLink="true">https://astro-pure.js.org/blog/brain2_note/brain2_note</guid><description>模拟神经网络</description><pubDate>Thu, 26 Feb 2026 23:48:00 GMT</pubDate><content:encoded>&lt;h2&gt;1. 导入&lt;/h2&gt;
&lt;p&gt;Brian2 的一个核心特性是它的物理单位检查系统（如 &lt;code&gt;mV&lt;/code&gt;, &lt;code&gt;ms&lt;/code&gt;, &lt;code&gt;nA&lt;/code&gt;）。为了让数学函数（如 &lt;code&gt;sin&lt;/code&gt;, &lt;code&gt;exp&lt;/code&gt;, &lt;code&gt;log&lt;/code&gt;）能够正确处理带单位的数值，Brian2 实际上重写了 NumPy 的部分同名函数。&lt;/p&gt;
&lt;p&gt;如果你不想使用 &lt;code&gt;from brian2 import *&lt;/code&gt;（因为这会污染全局命名空间），可以像下面这样写：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;import brian2.numpy_ as np  # 这是一个特殊包装过的 NumPy
import brian2.only as br2   # 只导入 Brian2 的核心功能
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;2. Pysical Units&lt;/h2&gt;
&lt;h3&gt;1. 基础单位 (Base Units)&lt;/h3&gt;
&lt;p&gt;Brian 严格遵循国际单位制 (SI)。它定义了 7 个基本单位，你可以直接在代码中使用它们的全称：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;电流&lt;/strong&gt;: &lt;code&gt;amp&lt;/code&gt; / &lt;code&gt;ampere&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;质量&lt;/strong&gt;: &lt;code&gt;kilogram&lt;/code&gt; / &lt;code&gt;kilogramme&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;时间&lt;/strong&gt;: &lt;code&gt;second&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;长度&lt;/strong&gt;: &lt;code&gt;metre&lt;/code&gt; / &lt;code&gt;meter&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;物质的量&lt;/strong&gt;: &lt;code&gt;mole&lt;/code&gt; / &lt;code&gt;mol&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;热力学温度&lt;/strong&gt;: &lt;code&gt;kelvin&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;发光强度&lt;/strong&gt;: &lt;code&gt;candela&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;2. 导出单位 (Derived Units)&lt;/h3&gt;
&lt;p&gt;基于基本单位，Brian 定义了神经科学中常用的导出单位：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;电荷/电容&lt;/strong&gt;: &lt;code&gt;coulomb&lt;/code&gt;, &lt;code&gt;farad&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;频率&lt;/strong&gt;: &lt;code&gt;hertz&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;能量/功率&lt;/strong&gt;: &lt;code&gt;joule&lt;/code&gt;, &lt;code&gt;watt&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;电压/电阻/电导&lt;/strong&gt;: &lt;code&gt;volt&lt;/code&gt;, &lt;code&gt;ohm&lt;/code&gt;, &lt;code&gt;siemens&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;体积/浓度&lt;/strong&gt;: &lt;code&gt;liter&lt;/code&gt; / &lt;code&gt;litre&lt;/code&gt;, &lt;code&gt;molar&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;压强/质量&lt;/strong&gt;: &lt;code&gt;pascal&lt;/code&gt;, &lt;code&gt;gram&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;3. 单位前缀与缩写规则&lt;/h3&gt;
&lt;p&gt;为了方便表达极小或极大的数值（如神经元的毫伏级电压），Brian 支持标准前缀：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;常用前缀&lt;/strong&gt;: &lt;code&gt;p&lt;/code&gt; (pico), &lt;code&gt;n&lt;/code&gt; (nano), &lt;code&gt;u&lt;/code&gt; (micro), &lt;code&gt;m&lt;/code&gt; (milli), &lt;code&gt;k&lt;/code&gt; (kilo), &lt;code&gt;M&lt;/code&gt; (mega), &lt;code&gt;G&lt;/code&gt; (giga), &lt;code&gt;T&lt;/code&gt; (tera)。例如 &lt;code&gt;msiemens&lt;/code&gt; 等于 $0.001 \times siemens$。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;两个特例&lt;/strong&gt;:
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;kilogram&lt;/code&gt; 不再接受额外前缀（防止双重前缀）。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;metre&lt;/code&gt; / &lt;code&gt;meter&lt;/code&gt; 额外支持 &lt;code&gt;centi&lt;/code&gt; (厘米) 前缀，即 &lt;code&gt;cmetre&lt;/code&gt;。&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;常用缩写&lt;/strong&gt;: 系统预设了一些极简缩写，如 &lt;code&gt;ms&lt;/code&gt; (毫秒), &lt;code&gt;mV&lt;/code&gt; (毫伏), &lt;code&gt;nS&lt;/code&gt; (纳西门子), &lt;code&gt;Hz&lt;/code&gt; (赫兹), &lt;code&gt;cm&lt;/code&gt; (厘米)。&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;4. 关键安全限制：禁止单字母缩写&lt;/h3&gt;
&lt;p&gt;这是初学者最容易踩的坑：&lt;strong&gt;Brian 不允许使用单字母缩写作为单位&lt;/strong&gt;。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;错误用法&lt;/strong&gt;: &lt;code&gt;v = 10 * V&lt;/code&gt; 或 &lt;code&gt;g = 5 * S&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;原因&lt;/strong&gt;: &lt;code&gt;V&lt;/code&gt; 或 &lt;code&gt;S&lt;/code&gt; 在 Python 编程中太容易被当作普通变量名（如 &lt;code&gt;V&lt;/code&gt; 代表 Voltage 数组）。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;正确做法&lt;/strong&gt;: 必须使用 &lt;code&gt;mV&lt;/code&gt; 或 &lt;code&gt;volt&lt;/code&gt;，以及 &lt;code&gt;nS&lt;/code&gt; 或 &lt;code&gt;siemens&lt;/code&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;5. 三种方法去除单位&lt;/h3&gt;
&lt;p&gt;| &lt;strong&gt;方法&lt;/strong&gt;              | &lt;strong&gt;描述&lt;/strong&gt;                                                     | &lt;strong&gt;示例代码&lt;/strong&gt;                  |
| --------------------- | ------------------------------------------------------------ | ----------------------------- |
| &lt;strong&gt;除以单位 (推荐)&lt;/strong&gt;   | 将变量除以你想要的单位，最安全且刻度清晰。                   | &lt;code&gt;tau / ms&lt;/code&gt; (结果为 20.0)      |
| &lt;strong&gt;转换为 NumPy 数组&lt;/strong&gt; | 使用 &lt;code&gt;asarray()&lt;/code&gt; (不复制) 或 &lt;code&gt;array()&lt;/code&gt; (复制) 转换为基准单位数组。 | &lt;code&gt;asarray(rates)&lt;/code&gt;              |
| &lt;strong&gt;使用下划线变量&lt;/strong&gt;    | 访问状态变量时在名称后加下划线 &lt;code&gt;_&lt;/code&gt;。                         | &lt;code&gt;G.v_&lt;/code&gt; (直接获取电压的纯数值) |&lt;/p&gt;
&lt;h3&gt;6. 关于温度单位转化&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;from brian2.units.constants import zero_celsius

celsius_temp = 27
abs_temp = celsius_temp*kelvin + zero_celsius
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;7. Constants&lt;/h3&gt;
&lt;p&gt;| &lt;strong&gt;常数名称 (Constant)&lt;/strong&gt;            | &lt;strong&gt;符号 (Symbol)&lt;/strong&gt; | &lt;strong&gt;Brian 名称&lt;/strong&gt;        | &lt;strong&gt;数值与单位 (Value)&lt;/strong&gt;                         |
| ---------------------------------- | ----------------- | --------------------- | ---------------------------------------------- |
| 阿伏伽德罗常数 (Avogadro constant) | $N_A, L$          | &lt;code&gt;avogadro_constant&lt;/code&gt;   | $6.022140857 \times 10^{23} \text{ mol}^{-1}$  |
| 玻尔兹曼常数 (Boltzmann constant)  | $k$               | &lt;code&gt;boltzmann_constant&lt;/code&gt;  | $1.38064852 \times 10^{-23} \text{ J K}^{-1}$  |
| 真空介电常数 (Electric constant)   | $\epsilon_0$      | &lt;code&gt;electric_constant&lt;/code&gt;   | $8.854187817 \times 10^{-12} \text{ F m}^{-1}$ |
| 电子质量 (Electron mass)           | $m_e$             | &lt;code&gt;electron_mass&lt;/code&gt;       | $9.10938356 \times 10^{-31} \text{ kg}$        |
| 元电荷 (Elementary charge)         | $e$               | &lt;code&gt;elementary_charge&lt;/code&gt;   | $1.6021766208 \times 10^{-19} \text{ C}$       |
| 法拉第常数 (Faraday constant)      | $F$               | &lt;code&gt;faraday_constant&lt;/code&gt;    | $96485.33289 \text{ C mol}^{-1}$               |
| 普适气体常数 (Gas constant)        | $R$               | &lt;code&gt;gas_constant&lt;/code&gt;        | $8.3144598 \text{ J mol}^{-1} \text{ K}^{-1}$  |
| 真空磁导率 (Magnetic constant)     | $\mu_0$           | &lt;code&gt;magnetic_constant&lt;/code&gt;   | $12.566370614 \times 10^{-7} \text{ N A}^{-2}$ |
| 摩尔质量常数 (Molar mass constant) | $M_u$             | &lt;code&gt;molar_mass_constant&lt;/code&gt; | $1 \times 10^{-3} \text{ kg mol}^{-1}$         |
| 摄氏零度 ($0^\circ\text{C}$)       | -                 | &lt;code&gt;zero_celsius&lt;/code&gt;        | $273.15 \text{ K}$                             |&lt;/p&gt;
&lt;p&gt;Note that these constants are not imported by default, you will have to explicitly import them from brian2.units.constants.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;from brian2 import *
from brian2.units.constants import zero_celsius, gas_constant as R, faraday_constant as F

celsius_temp = 27
T = celsius_temp*kelvin + zero_celsius
factor = R*T/F
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;8. Import Units&lt;/h3&gt;
&lt;p&gt;Brain also generates squared and cubed versions by appending a number.&lt;/p&gt;
&lt;p&gt;You can import these units from the package &lt;code&gt;brian2.units.allunits&lt;/code&gt; – accordingly, an &lt;code&gt;from brian2.units.allunits import *&lt;/code&gt; will result in everything from &lt;code&gt;Ylumen3&lt;/code&gt; (cubed yotta lumen) to &lt;code&gt;ymol&lt;/code&gt; (yocto mole) being imported.&lt;/p&gt;
&lt;h3&gt;9. &lt;a href=&quot;https://brian2.readthedocs.io/en/stable/user/units.html#id8&quot;&gt;In-place operations on quantities&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;数量数组：原地修改（可变性）&lt;/p&gt;
&lt;p&gt;当你对一个包含多个数值的单位数组（Quantity array）使用 &lt;code&gt;+=&lt;/code&gt; 时，它会直接修改内存中的原数组。&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;q = [1, 2] * mV  # 创建一个数组对象
r = q            # r 和 q 指向内存中同一个地址
q += 1*mV        # 原地修改数组内容
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;当你对单个带有单位的数值（Scalar quantity）进行运算时，它不会修改原对象，而是创建一个新的结果。&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;x = 1 * mV
y = x            # y 指向数值 1*mV
x *= 2           # 实际上是创建了新值 2*mV 并让变量名 x 指向它
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;2. Models and neuron groups&lt;/h2&gt;
&lt;h3&gt;1. model quation&lt;/h3&gt;
&lt;p&gt;通过&lt;code&gt;NeuronGroup&lt;/code&gt;指定生成神经元群的数量和对应的微分方程：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;G = NeuronGroup(10, &apos;dv/dt = -v/(10*ms) : volt&apos;)

tau = 10*ms
G = NeuronGroup(10, &apos;dv/dt = -v/tau : volt&apos;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Brian needs the model to be given in the form of differential equations, but you might see the integrated form of synapses in some textbooks and papers. See &lt;a href=&quot;https://brian2.readthedocs.io/en/stable/user/converting_from_integrated_form.html&quot;&gt;Converting from integrated form to ODEs&lt;/a&gt; for details on how to convert between these representations.&lt;/p&gt;
&lt;p&gt;If a variable should be taken as a &lt;em&gt;parameter&lt;/em&gt; of the neurons, i.e. if it should be possible to vary its value across neurons, it has to be declared as part of the model description:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;G = NeuronGroup(10, &apos;&apos;&apos;dv/dt = -v/tau : volt
                       tau : second&apos;&apos;&apos;)

# To make complex model descriptions more readable, named subexpressions can be used
G = NeuronGroup(10, &apos;&apos;&apos;dv/dt = I_leak / Cm : volt
                       I_leak = g_L*(E_L - v) : amp&apos;&apos;&apos;)
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;2. Noise&lt;/h3&gt;
&lt;p&gt;In addition to ordinary differential equations, Brian allows you to introduce random noise by specifying a &lt;a href=&quot;https://en.wikipedia.org/wiki/Stochastic_differential_equation&quot;&gt;stochastic differential equation&lt;/a&gt;. Brian uses the physicists&apos; notation used in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Langevin_equation&quot;&gt;Langevin equation&lt;/a&gt;, representing the &quot;noise&quot; as a term $\xi(t)$, rather than the mathematicians&apos; stochastic differential $dW_t$. The following is an example of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Ornstein%E2%80%93Uhlenbeck_process&quot;&gt;Ornstein-Uhlenbeck process&lt;/a&gt; that is often used to model a leaky integrate-and-fire neuron with a stochastic current:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;G = NeuronGroup(10, &apos;dv/dt = -v/tau + sigma*sqrt(2/tau)*xi : volt&apos;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can start by thinking of &lt;code&gt;xi&lt;/code&gt; as just a Gaussian random variable with mean 0 and standard deviation 1. However, it scales in an unusual way with time and this gives it units of &lt;code&gt;1/sqrt(second)&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;3. &lt;a href=&quot;https://brian2.readthedocs.io/en/stable/user/models.html#id9&quot;&gt;Threshold and reset&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Whenever the threshold condition is fulfilled, the reset statements will be executed.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;v_r = -70*mV  # reset potential
G = NeuronGroup(10, &apos;&apos;&apos;dv/dt = -v/tau : volt
                       v_th : volt  # neuron-specific threshold&apos;&apos;&apos;,
                threshold=&apos;v &gt; v_th&apos;, reset=&apos;v = v_r&apos;)
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;4. &lt;a href=&quot;https://brian2.readthedocs.io/en/stable/user/models.html#id10&quot;&gt;Refractoriness&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To make a neuron non-excitable for a certain time period after a spike, the refractory keyword can be used:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;G = NeuronGroup(10, &apos;dv/dt = -v/tau : volt&apos;, 
				threshold=&apos;v &gt; -50*mV&apos;,
                reset=&apos;v = -70*mV&apos;, refractory=5*ms)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;默认行为：锁定在 Reset 电位&lt;/p&gt;
&lt;p&gt;除了这种简单的固定时长限制外，该关键字还支持更复杂的表达方式（例如，不仅禁止触发脉冲，还可以在不应期内让膜电位保持在某个固定值，或者使用变量来定义时长）。参考&lt;a href=&quot;https://brian2.readthedocs.io/en/stable/user/refractoriness.html&quot;&gt;Refractoriness&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;5. &lt;a href=&quot;https://brian2.readthedocs.io/en/stable/user/models.html#id11&quot;&gt;State variables&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Differential equations and parameters in model descriptions are stored as &lt;em&gt;state variables&lt;/em&gt; of the &lt;a href=&quot;https://brian2.readthedocs.io/en/stable/reference/brian2.groups.neurongroup.NeuronGroup.html#brian2.groups.neurongroup.NeuronGroup&quot;&gt;&lt;code&gt;NeuronGroup&lt;/code&gt;&lt;/a&gt;. In addition to these variables, Brian also defines two variables automatically: &lt;code&gt;i&lt;/code&gt;: The index of a neuron. &lt;code&gt;N&lt;/code&gt;: The total number of neurons.&lt;/p&gt;
&lt;p&gt;All state variables can be accessed and set as an attribute of the group. To get the values without physical units (e.g. for analysing data with external tools), use an underscore after the name:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;# 初始化神经元组并赋值
&gt;&gt;&gt; G = NeuronGroup(10, &apos;&apos;&apos;dv/dt = -v/tau : volt
...                        tau : second&apos;&apos;&apos;, name=&apos;neurons&apos;)
&gt;&gt;&gt; G.v = -70*mV
&gt;&gt;&gt; G.v
&amp;#x3C;neurons.v: array([-70., -70., -70., -70., -70., -70., -70., -70., -70., -70.]) * mvolt&gt;

# 使用下划线获取无单位的原始数值 (SI unit: Volts)
&gt;&gt;&gt; G.v_  # values without units
&amp;#x3C;neurons.v_: array([-0.07, -0.07, -0.07, -0.07, -0.07, -0.07, -0.07, -0.07, -0.07, -0.07])&gt;

# 使用字符串表达式为每个神经元分配不同的 tau 值
# 其中 i 是神经元索引，N 是总数
&gt;&gt;&gt; G.tau = &apos;5*ms + (1.0*i/N)*5*ms&apos;
&gt;&gt;&gt; G.tau
&amp;#x3C;neurons.tau: array([ 5. ,  5.5,  6. ,  6.5,  7. ,  7.5,  8. ,  8.5,  9. ,  9.5]) * msecond&gt;

# 使用条件表达式（String Indexing）进行切片赋值
# 将所有 tau &gt; 7.25ms 的神经元电压设置为 -60mV
&gt;&gt;&gt; G.v[&apos;tau &gt; 7.25*ms&apos;] = -60*mV
&gt;&gt;&gt; G.v
&amp;#x3C;neurons.v: array([-70., -70., -70., -70., -70., -60., -60., -60., -60., -60.]) * mvolt&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;6. &lt;a href=&quot;https://brian2.readthedocs.io/en/stable/user/models.html#id12&quot;&gt;Subgroups&lt;/a&gt;&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;G = NeuronGroup(10, &apos;&apos;&apos;dv/dt = -v/tau : volt
                       tau : second&apos;&apos;&apos;,
                threshold=&apos;v &gt; -50*mV&apos;,
                reset=&apos;v = -70*mV&apos;)
# Create subgroups
G1 = G[:5]
G2 = G[5:]

# This will set the values in the main group, subgroups are just &quot;views&quot;
G1.tau = 10*ms
G2.tau = 20*ms
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;注意我们不能直接对&lt;code&gt;NeuronGroup&lt;/code&gt;进行不连续切片：&lt;code&gt;G[[3, 5, 7]]&lt;/code&gt;，但是我们可以用下面的方法代替：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;# 在模型定义中增加一个标记位（可以是布尔值或整数）
G = NeuronGroup(10, &apos;&apos;&apos;...
                       is_target : boolean&apos;&apos;&apos;)

# 手动标记你不连续的神经元
target_indices = [3, 5, 7]
G.is_target = False
G.v[target_indices] = -60*mV # 直接对主组的不连续索引操作
G.is_target[target_indices] = True

# 后续操作时使用字符串筛选
# 比如只让这些特定的神经元受到刺激
G.I[&apos;is_target == True&apos;] = 10*nA
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;7. &lt;a href=&quot;https://brian2.readthedocs.io/en/stable/user/models.html#id13&quot;&gt;Shared variables&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;通常情况下，&lt;code&gt;NeuronGroup&lt;/code&gt; 中的变量（如膜电位 &lt;code&gt;v&lt;/code&gt;）是&lt;strong&gt;向量化&lt;/strong&gt;的，即每个神经元都有自己独立的值。但有时你需要一个对组内&lt;strong&gt;所有神经元都相同&lt;/strong&gt;的变量，这就是“共享变量”。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;限制&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;不能在只针对“部分”神经元的上下文中使用（例如 &lt;code&gt;reset&lt;/code&gt; 语句中，因为重置通常只发生在刚放电的特定神经元上）。&lt;/li&gt;
&lt;li&gt;如果代码块中同时写共享变量和普通向量变量，&lt;strong&gt;共享变量的赋值必须写在前面&lt;/strong&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;G = NeuronGroup(10, &apos;&apos;&apos;shared_input : volt (shared)
                       dv/dt = (-v + shared_input)/tau : volt
                       tau : second&apos;&apos;&apos;, name=&apos;neurons&apos;)
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;8. Subexpressions&lt;/h3&gt;
&lt;p&gt;By default, subexpressions are re-evaluated whenever they are used. Sometimes it is useful to instead only evaluate a subexpression once and then use this value for the rest of the time step.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;关键标志：&lt;code&gt;(constant over dt)&lt;/code&gt;&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;如果你希望在&lt;strong&gt;一个时间步内 ($dt$)&lt;/strong&gt; 只计算一次该值，并在随后的所有计算中复用该值，就需要加上这个标志。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;重要场景&lt;/strong&gt;：当子表达式包含随机函数（如 &lt;code&gt;rand()&lt;/code&gt;）时，&lt;strong&gt;必须&lt;/strong&gt;使用这个标志。否则，如果你用 &lt;code&gt;StateMonitor&lt;/code&gt; 记录它，记录下来的值会和神经元方程里实际使用的值不一样（因为每次调用都生成了新的随机数）。&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;# 默认情况下，每次用到 &apos;current_sum&apos;，Brian2 都会重新计算一遍
# 对于确定性表达式，加不加标志对结果没有影响。
eqs = &apos;&apos;&apos;
dv/dt = (I_leak + current_sum) / C : volt
current_sum = I_ext + I_syn : amp  # 子表达式
&apos;&apos;&apos;

eqs = &apos;&apos;&apos;
dv/dt = (-(v - v_rest) + xi_noise) / tau : volt
xi_noise = 0.1 * rand() : 1 (constant over dt) # 强制每步只计算一次
&apos;&apos;&apos;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;结果：&lt;/strong&gt; 在每一个 $dt$ 开始时，Brian2 生成一个随机数存入 &lt;code&gt;xi_noise&lt;/code&gt;。在该步内的所有后续计算（包括 &lt;code&gt;StateMonitor&lt;/code&gt; 的记录）都会使用这&lt;strong&gt;同一个&lt;/strong&gt;数值。&lt;/p&gt;
&lt;h3&gt;9. &lt;a href=&quot;https://brian2.readthedocs.io/en/stable/user/models.html#id14&quot;&gt;Storing state variables&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Sometimes it can be convenient to access multiple state variables at once, e.g. to set initial values from a dictionary of values or to store all the values of a group on disk. This can be done with the &lt;a href=&quot;https://brian2.readthedocs.io/en/stable/reference/brian2.groups.group.VariableOwner.html#brian2.groups.group.VariableOwner.get_states&quot;&gt;&lt;code&gt;get_states()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://brian2.readthedocs.io/en/stable/reference/brian2.groups.group.VariableOwner.html#brian2.groups.group.VariableOwner.set_states&quot;&gt;&lt;code&gt;set_states()&lt;/code&gt;&lt;/a&gt; methods&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;&gt;&gt;&gt; group = NeuronGroup(5, &apos;&apos;&apos;dv/dt = -v/tau : 1
...                          tau : second&apos;&apos;&apos;, name=&apos;neurons&apos;)
&gt;&gt;&gt; initial_values = {&apos;v&apos;: [0, 1, 2, 3, 4],
...                   &apos;tau&apos;: [10, 20, 10, 20, 10]*ms}
&gt;&gt;&gt; group.set_states(initial_values)
&gt;&gt;&gt; group.v[:]
array([ 0.,  1.,  2.,  3.,  4.])
&gt;&gt;&gt; group.tau[:]
array([ 10.,  20.,  10.,  20.,  10.]) * msecond
&gt;&gt;&gt; states = group.get_states()
&gt;&gt;&gt; states[&apos;v&apos;]
array([ 0.,  1.,  2.,  3.,  4.])

&gt;&gt;&gt; df = group.get_states(units=False, format=&apos;pandas&apos;)
&gt;&gt;&gt; df
   N      dt  i    t   tau    v
0  5  0.0001  0  0.0  0.01  0.0
1  5  0.0001  1  0.0  0.02  1.0
2  5  0.0001  2  0.0  0.01  2.0
3  5  0.0001  3  0.0  0.02  3.0
4  5  0.0001  4  0.0  0.01  4.0
&gt;&gt;&gt; df[&apos;tau&apos;]
0    0.01
1    0.02
2    0.01
3    0.02
4    0.01
Name: tau, dtype: float64
&gt;&gt;&gt; df[&apos;tau&apos;] *= 2
&gt;&gt;&gt; group.set_states(df[[&apos;tau&apos;]], units=False, format=&apos;pandas&apos;)
&gt;&gt;&gt; group.tau
&amp;#x3C;neurons.tau: array([ 20.,  40.,  20.,  40.,  20.]) * msecond&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;10. &lt;a href=&quot;https://brian2.readthedocs.io/en/stable/user/models.html#id15&quot;&gt;Linked variables&lt;/a&gt;&lt;/h3&gt;
&lt;h3&gt;11. &lt;a href=&quot;https://brian2.readthedocs.io/en/stable/user/models.html#id16&quot;&gt;Time scaling of noise&lt;/a&gt;&lt;/h3&gt;</content:encoded><h:img src="/_astro/Brain2.zW6ED_qG.png"/><enclosure url="/_astro/Brain2.zW6ED_qG.png"/></item><item><title>在Folo中用RSS订阅一切</title><link>https://astro-pure.js.org/blog/folo-rss/folo-rss</link><guid isPermaLink="true">https://astro-pure.js.org/blog/folo-rss/folo-rss</guid><description>信息流减法</description><pubDate>Sun, 22 Feb 2026 21:02:00 GMT</pubDate><content:encoded>&lt;p&gt;对于bilibili的教程：&lt;a href=&quot;https://www.oryoy.com/news/bilibili-yong-hu-rss-ding-yue-yuan-huo-qu-jiao-cheng-jie-jue-wu-fa-ding-yue-yu-shi-xiao-wen-ti-de-zh.html&quot;&gt;Bilibili用户RSS订阅源获取教程：解决无法订阅与失效问题的终极指南 - 云原生实践&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;使用&lt;code&gt;https://rsshub.app/bilibili/user/video/{uid}&lt;/code&gt;订阅用户投稿&lt;/p&gt;
&lt;p&gt;对于youtube：使用&lt;code&gt;rsshub://youtube/user/{uid}&lt;/code&gt;, uid为@后面的&lt;/p&gt;
&lt;p&gt;或者&lt;code&gt;https://www.youtube.com/feeds/videos.xml?channel_id={查看网页URL}&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;https://www.youtube.com/feeds/videos.xml?playlist_id=PLCgD3ws8aVdolCexlz8f3U-RROA0s5jWA&lt;/code&gt;&lt;/p&gt;
&lt;h4&gt;1. 订阅“合集” (Collection)&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;公式&lt;/strong&gt;：&lt;code&gt;http://你的服务器IP:1200/bilibili/user/collection/UID/SID&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;UID&lt;/strong&gt;：UP 主的数字 ID。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SID&lt;/strong&gt;：你在地址栏看到的 &lt;code&gt;collectiondetail?sid=&lt;/code&gt; 后面的数字。&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;2. 订阅“视频列表” (Series)&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;公式&lt;/strong&gt;：&lt;code&gt;http://你的服务器IP:1200/bilibili/user/series/UID/SID&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;UID&lt;/strong&gt;：UP 主的数字 ID。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SID&lt;/strong&gt;：你在地址栏看到的 &lt;code&gt;seriesdetail?sid=&lt;/code&gt; 后面的数字。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;特定视频集合如：&lt;code&gt;http://你的服务器IP:1200/bilibili/video/page/BV1LD6BBPEjt&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;RSS参数教程：https://docs.rsshub.app/zh/guide/parameters&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;对于微信公众号：&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;docker run -d \
  --name wewe-rss \
  -p 4000:4000 \
  -e DATABASE_TYPE=sqlite \
  -e AUTH_CODE={设置} \
  -v $(pwd)/data:/app/data \
  cooderl/wewe-rss-sqlite:latest
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;之后防火墙放行4000端口&lt;/p&gt;
&lt;p&gt;登录之后，输入文章链接，可以自动生成对应公众号的RSS Feed，最后通过.opml文件导出&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;对于知乎：&lt;/p&gt;
&lt;p&gt;A. 订阅知乎专栏&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;路由格式&lt;/strong&gt;：&lt;code&gt;/zhihu/zhuanlan/:id&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;如何获取 ID&lt;/strong&gt;：打开专栏网页，URL 末尾的部分即为 ID。例如专栏 &lt;code&gt;https://zhuanlan.zhihu.com/p/12345&lt;/code&gt;，ID 就是 &lt;code&gt;12345&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;你的 Feed 链接&lt;/strong&gt;：&lt;code&gt;http://你的服务器IP:1200/zhihu/zhuanlan/12345&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;B. 订阅特定用户的动态&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;路由格式&lt;/strong&gt;：&lt;code&gt;/zhihu/people/activities/:id&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;如何获取 ID&lt;/strong&gt;：用户个人主页 URL 中 &lt;code&gt;people/&lt;/code&gt; 后面的部分。例如：&lt;code&gt;https://www.zhihu.com/people/excited-vczh&lt;/code&gt;，ID 为 &lt;code&gt;excited-vczh&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;你的 Feed 链接&lt;/strong&gt;：&lt;code&gt;http://你的服务器IP:1200/zhihu/people/activities/excited-vczh&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;C. 订阅某个问题的回答&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;路由格式&lt;/strong&gt;：&lt;code&gt;/zhihu/question/:questionId&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;你的 Feed 链接&lt;/strong&gt;：&lt;code&gt;http://你的服务器IP:1200/zhihu/question/12345678&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;D. 知乎热榜&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;路由格式&lt;/strong&gt;：&lt;code&gt;/zhihu/hotlist&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;你的 Feed 链接&lt;/strong&gt;：&lt;code&gt;http://你的服务器IP:1200/zhihu/hotlist&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;反反爬虫：&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;vim /opt/rsshub/docker-compose.yml
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;用vim编辑，加入知乎cookie：&lt;code&gt;\- ZHIHU_COOKIES=&quot;_xsrf=1Hkej...这里是你那串极长的内容...; BEC=63a63...&quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;之后&lt;code&gt;docker compose up -d&lt;/code&gt;让 Docker 重新读取配置并重启容器&lt;/p&gt;</content:encoded><h:img src="/_astro/RSS.ViIqgOrh.png"/><enclosure url="/_astro/RSS.ViIqgOrh.png"/></item><item><title>RSS自动推送论文配置（无需服务器）</title><link>https://astro-pure.js.org/blog/rssset/rssset</link><guid isPermaLink="true">https://astro-pure.js.org/blog/rssset/rssset</guid><description>信息流减法</description><pubDate>Sun, 22 Feb 2026 21:02:00 GMT</pubDate><content:encoded>&lt;p&gt;每天只需api费用最多0.35元，平均一个月不到10块（可能只有5块左右？）&lt;/p&gt;
&lt;p&gt;这是一个非常极客且高效的方案！将纯代码脚本部署在 &lt;strong&gt;Cloudflare Workers&lt;/strong&gt; 上，不仅完全免费、无需维护服务器，还能利用它的 Cron 定时触发器（Cron Triggers）实现完美的自动化。&lt;/p&gt;
&lt;p&gt;由于 Cloudflare Workers 原生不支持直接通过 SMTP 发送邮件，我们最优雅的免费方案是结合 &lt;strong&gt;Resend&lt;/strong&gt;（一个对开发者极度友好的邮件 API 平台，免费额度每天 100 封，完全足够你一个人使用）。&lt;/p&gt;
&lt;p&gt;整体架构如下：&lt;/p&gt;
&lt;p&gt;Code snippet&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-mermaid&quot;&gt;graph TD
    A[&quot;定时触发器 (Cron)&quot;] --&gt; B[&quot;获取计算神经科学与 AI RSS&quot;]
    B[&quot;获取计算神经科学与 AI RSS&quot;] --&gt; C[&quot;调用 DeepSeek API 提炼摘要&quot;]
    C[&quot;调用 DeepSeek API 提炼摘要&quot;] --&gt; D[&quot;调用 Resend API 构建邮件&quot;]
    D[&quot;调用 Resend API 构建邮件&quot;] --&gt; E[&quot;推送到你的个人邮箱&quot;]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;📊 Diagram&amp;#x3C;/&gt; Code&lt;/p&gt;
&lt;p&gt;定时触发器 (Cron)获取计算神经科学与 AI RSS调用 DeepSeek API 提炼摘要调用 Resend API 构建邮件推送到你的个人邮箱&lt;/p&gt;
&lt;p&gt;以下是手把手带你搭建这套“零成本学术晨报”流的详细步骤：&lt;/p&gt;
&lt;h3&gt;Step 1: 准备好免费的 API Keys&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;AI 模型 (DeepSeek)&lt;/strong&gt;：前往 DeepSeek 开放平台，生成一个 API Key（因为它的模型能力极强且 API 极其便宜/兼容 OpenAI 格式）。但我选择kimi。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;邮件服务 (Resend)&lt;/strong&gt;：
&lt;ul&gt;
&lt;li&gt;前往 &lt;a href=&quot;https://resend.com/&quot;&gt;Resend.com&lt;/a&gt; 注册账号。&lt;/li&gt;
&lt;li&gt;在 &lt;code&gt;API Keys&lt;/code&gt; 页面生成一个秘钥。&lt;/li&gt;
&lt;li&gt;（可选但推荐）在 &lt;code&gt;Domains&lt;/code&gt; 验证你的个人域名（比如你之前提到的 zikaifang.link），这样发件人看起来更正式。如果不验证，也可以使用 Resend 提供的测试域名发送到你注册时的邮箱。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Step 2: 初始化 Cloudflare Worker 项目&lt;/h3&gt;
&lt;p&gt;在你电脑的本地终端执行以下命令来初始化项目：&lt;/p&gt;
&lt;p&gt;Bash&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-powershell&quot;&gt;# 使用官方工具创建 Worker，起名为 my-rss-digest
npm create cloudflare@latest my-rss-digest

# 在提示中选择：
# - What would you like to start with? : Hello World Example
# - Which template would you like to use? : Scheduled Worker (Cron Trigger)
# - Which language do you want to use? : Typescript
# - Do you want to add an AGENTs.md file to help AI coding tools understand Cloudflare APIs? ：Yes
# - Do you want to use git for version control? ：Yes
# - Do you want to deploy your application? ：No

cd my-rss-digest
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;为了方便解析 RSS 的 XML 格式，我们可以安装一个轻量级的解析库：&lt;/p&gt;
&lt;p&gt;Bash&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-powershell&quot;&gt;npm install fast-xml-parser
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Step 3: 编写核心逻辑代码&lt;/h3&gt;
&lt;p&gt;打开 &lt;code&gt;src/index.ts&lt;/code&gt;（或者 &lt;code&gt;index.js&lt;/code&gt;），将里面的代码替换为以下核心逻辑。这段代码实现了“抓取 -&gt; 让 AI 总结 -&gt; 发邮件”的完整流水线：&lt;/p&gt;
&lt;p&gt;TypeScript&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Step 4: 配置环境变量与定时器&lt;/h3&gt;
&lt;p&gt;打开项目根目录下的 &lt;code&gt;wrangler.toml&lt;/code&gt; 文件，配置你的定时任务时间。这里采用标准的 Cron 语法。&lt;/p&gt;
&lt;p&gt;Ini, TOML&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;name = &quot;my-rss-digest&quot;
main = &quot;src/index.ts&quot;
compatibility_date = &quot;2024-02-22&quot;

# 配置定时触发器 (UTC 时间，如果北京时间早上 8 点，对应 UTC 是 0 点)
[triggers]
crons = [&quot;0 0 * * *&quot;] 

# 我们不在代码里硬编码秘钥，稍后通过命令行上传这些变量
# DEEPSEEK_API_KEY
# RESEND_API_KEY
# TARGET_EMAIL
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Step 5: 部署并注入环境变量&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;在终端运行部署命令，按提示登录你的 Cloudflare 账号：&lt;/p&gt;
&lt;p&gt;Bash&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;npx wrangler deploy
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;部署成功后，将你的 API 秘钥安全地注入到 Cloudflare 的环境变量中：&lt;/p&gt;
&lt;p&gt;Bash&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;npx wrangler secret put OPENAI_API_KEY
# 粘贴你的 DeepSeek 秘钥并回车

npx wrangler secret put RESEND_API_KEY
# 粘贴你的 Resend 秘钥并回车

npx wrangler secret put TARGET_EMAIL
# 粘贴你要接收邮件的邮箱地址并回车

npx wrangler secret put OPENAI_MODEL
# kimi-k2.5
# kimi-k2-0905-preview

npx wrangler secret put RESEND_FROM_EMAIL

npm run deploy
# 重新部署

npm run run:brief
# 使用这个命令立刻本地运行查看结果
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;完成！&lt;/h3&gt;
&lt;p&gt;现在，这套系统已经免费托管在 Cloudflare 全球边缘网络上了。它每天早上都会自动抓取 arXiv 的最新论文，发送给大模型进行阅读和提炼，然后将排版好的中文晨报稳稳地投递到你的邮箱里。&lt;/p&gt;
&lt;p&gt;你可以先通过分配给你的 &lt;code&gt;*.workers.dev&lt;/code&gt; 域名在浏览器里访问一次触发它，测试看看你的邮箱是否能立刻收到这份专属的 AI 学术总结！如果遇到 XML 结构解析的小问题，你可以随时在代码中微调。&lt;/p&gt;
&lt;p&gt;验证RSS：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-powershell&quot;&gt;curl.exe -A &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36&quot; -I &quot;http://connect.biorxiv.org/biorxiv_xml.php?subject=neuroscience&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;p&gt;《Journal of Vision》和《Vision Research》都被 PubMed 完整收录。PubMed 的接口不仅极其稳定、永远在线，而且返回的 XML 结构非常干净规范，解析起来比出版商乱七八糟的网页结构舒服得多。&lt;/p&gt;
&lt;h3&gt;获取这两个期刊稳定 RSS 的步骤：&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;访问 PubMed 官网&lt;/strong&gt; (pubmed.ncbi.nlm.nih.gov)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;输入精准的期刊检索式&lt;/strong&gt;：
&lt;ul&gt;
&lt;li&gt;检索 JOV：&lt;code&gt;&quot;Journal of Vision&quot;[Journal]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;检索 Vision Research：&lt;code&gt;&quot;Vision Research&quot;[Journal]&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;生成专属链接&lt;/strong&gt;：在搜索框正下方，点击 &lt;strong&gt;&quot;Create RSS&quot;&lt;/strong&gt; 按钮。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;自定义设置&lt;/strong&gt;：你可以将 &quot;Number of items displayed&quot; 设置为 15 或 50，然后点击 &quot;Create RSS&quot; 获取专属的 XML 链接，直接填入你的代码配置中即可。&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;💡 一个进阶技巧&lt;/h3&gt;
&lt;p&gt;使用 PubMed 作为 RSS 生成器最大的优势在于它支持复杂的布尔逻辑（Boolean logic）。你不仅可以订阅整个期刊，还可以直接在源头加上极其垂直的关键词过滤。&lt;/p&gt;
&lt;p&gt;例如，你可以构造这样一个高级检索式来生成聚合 RSS： &lt;code&gt;(&quot;Journal of Vision&quot;[Journal] OR &quot;Vision Research&quot;[Journal]) AND (orientation-selective cells OR mouse visual cortex)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;这样生成的专属 RSS 源，只要有关于小鼠视觉皮层或方向选择性细胞等核心机制的新文章发表，你的晨报系统就能第一时间精准捕获，完全不需要耗费大模型的 Token 去做海量文章的二次筛选。&lt;/p&gt;</content:encoded><h:img src="/_astro/RSS.ViIqgOrh.png"/><enclosure url="/_astro/RSS.ViIqgOrh.png"/></item><item><title>Leaky Integrate-and-Fire (LIF)</title><link>https://astro-pure.js.org/blog/neuroscience/neuroscience</link><guid isPermaLink="true">https://astro-pure.js.org/blog/neuroscience/neuroscience</guid><description>记录研究中遇到的知识漏洞</description><pubDate>Thu, 12 Feb 2026 23:17:00 GMT</pubDate><content:encoded>&lt;p&gt;我们将使用 Leaky Integrate-and-Fire (LIF) 模型来模拟神经元的电位变化。在该模型中，神经元像一个漏电的电容器，不断整合输入信号，并在达到阈值时放电。&lt;/p&gt;
&lt;h3&gt;神经元动力学模拟图&lt;/h3&gt;
&lt;p&gt;在下图中，你可以直观地看到这几个参数如何控制神经元的行为：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Threshold ($\theta = 20$):&lt;/strong&gt; 红色虚线。当电位触及此线，神经元发放脉冲（图中垂直的长线）。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reset Potential ($V_r = 10$):&lt;/strong&gt; 绿色虚线。放电结束后，电位立即掉落到的位置。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Memory Time ($\tau_E = 0.02s$):&lt;/strong&gt; 紫色双向箭头标注。它决定了电位向静息状态衰减的快慢。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Resting Potential ($V_{rest} = 0$)&lt;/strong&gt;: 灰色代表静息电位，一般设为0&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;./LIF.png&quot; alt=&quot;LIF&quot;&gt;&lt;/p&gt;
&lt;h3&gt;画图代码&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;import numpy as np
import matplotlib.pyplot as plt

# 1. 参数设置
tau_E = 0.02    # 兴奋性神经元时间常数 (20ms)
theta = 20      # 发放阈值 (mV)
V_r = 10        # 复位电位 (mV)
V_rest = 0      # 静息电位 (mV)
dt = 0.0001     # 模拟步长 (0.1ms)
T = 0.15        # 总模拟时间 (150ms)
t = np.arange(0, T, dt)

# 2. 初始化变量
V = np.zeros_like(t)
V[0] = V_rest
# 设置输入电流：在10ms到60ms之间给予刺激
I = np.zeros_like(t)
I[(t &gt; 0.01) &amp;#x26; (t &amp;#x3C; 0.06)] = 35.0 

# 3. 欧拉法数值模拟 (LIF 模型)
v_val = V_rest
for i in range(1, len(t)):
    # 核心公式: dV = (-(V - V_rest) + I) / tau * dt
    dv = (-(v_val - V_rest) + I[i]) / tau_E * dt
    v_val += dv
    
    # 检查是否达到阈值
    if v_val &gt;= theta:
        V[i] = 40   # 绘制脉冲峰值 (仅用于可视化)
        v_val = V_r # 电位重置
    else:
        V[i] = v_val

# 4. 绘图与标注
plt.figure(figsize=(12, 6))
plt.plot(t * 1000, V, label=&apos;Membrane Potential $V(t)$&apos;, color=&apos;#1f77b4&apos;, lw=2)

# 标注阈值和复位电位
plt.axhline(y=theta, color=&apos;red&apos;, linestyle=&apos;--&apos;, alpha=0.7)
plt.text(152, theta, r&apos;Threshold $\theta$&apos;, color=&apos;red&apos;, va=&apos;center&apos;)

plt.axhline(y=V_r, color=&apos;green&apos;, linestyle=&apos;--&apos;, alpha=0.7)
plt.text(152, V_r, r&apos;Reset $V_r$&apos;, color=&apos;green&apos;, va=&apos;center&apos;)

# 标注记忆时间 (Tau) - 展示在刺激停止后的衰减过程
# 时间常数定义为电位下降到 1/e (~37%) 所需的时间
decay_start_t = 60 # ms
plt.annotate(&apos;&apos;, xy=(decay_start_t, 18), xytext=(decay_start_t + tau_E*1000, 18),
             arrowprops=dict(arrowstyle=&apos;&amp;#x3C;-&gt;&apos;, color=&apos;purple&apos;, lw=1.5))
plt.text(decay_start_t + 2, 20, r&apos;Memory Time $\tau_E = 20ms$&apos;, color=&apos;purple&apos;, fontweight=&apos;bold&apos;)

# 修饰图表
plt.title(&apos;LIF Neuron Dynamics Simulation&apos;, fontsize=14)
plt.xlabel(&apos;Time (ms)&apos;)
plt.ylabel(&apos;Membrane Potential (mV)&apos;)
plt.ylim(-5, 45)
plt.xlim(0, 150)
plt.grid(True, which=&apos;both&apos;, linestyle=&apos;:&apos;, alpha=0.5)
plt.legend(loc=&apos;upper right&apos;)

plt.tight_layout()
plt.show()
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;理解的问题&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Ornstein-Uhlenbeck (OU) 过程：&lt;/strong&gt; 这个方程在数学上描述的是一个 &lt;strong&gt;OU 过程&lt;/strong&gt;。在长时极限下，如果神经元没有发放阈值，电压 $V$ 的平稳分布将是一个均值为 $\mu$、方差为 $\frac{\sigma^2}{2}$ 的正态分布。这种参数化方式使得噪声强度 $\sigma$ 的物理意义更加明确，不随时间常数 $\tau$ 的改变而发生缩放冲突。&lt;/p&gt;</content:encoded><h:img src="/_astro/LIF.UnDvUUaO.png"/><enclosure url="/_astro/LIF.UnDvUUaO.png"/></item><item><title>LunaTranslator制anki卡组的个人配置改进</title><link>https://astro-pure.js.org/blog/lunatranslator/lunatranslator</link><guid isPermaLink="true">https://astro-pure.js.org/blog/lunatranslator/lunatranslator</guid><description>玩Galgame学习日语</description><pubDate>Thu, 05 Feb 2026 18:11:00 GMT</pubDate><content:encoded>&lt;p&gt;本章内容建立在成功安装&lt;a href=&quot;https://github.com/HIllya51/LunaTranslator&quot;&gt;LunaTranslator&lt;/a&gt;，并可以正常添加anki卡片的基础上。&lt;/p&gt;
&lt;h2&gt;1. 主要目标&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;卡片美化&lt;/li&gt;
&lt;li&gt;例句的汉字也标上平假名（不然初学者真有点听不出来）&lt;/li&gt;
&lt;li&gt;附上单词、语法的简单解释，不然语法不好的我可能无法做到可理解输入(comprehensive input)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2. 卡片改变&lt;/h2&gt;
&lt;p&gt;创建新字段：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;Sentence_With_Reading&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Word_Analysis&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Grammar_Note&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;修改正面、背面、样式代码：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;正面：&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;#x3C;div class=&quot;hide-style&quot;&gt;
    &amp;#x3C;div id=&quot;audio&quot;&gt;{{audio_for_word}}&amp;#x3C;/div&gt;
    &amp;#x3C;div id=&quot;audio_sentence&quot;&gt;{{audio_for_example_sentence}}&amp;#x3C;/div&gt;
&amp;#x3C;/div&gt;

&amp;#x3C;div class=&quot;centerdiv&quot; onclick=&apos;playAudio(&quot;audio&quot;)&apos;&gt;
    &amp;#x3C;div class=&quot;ruby-div&quot; id=&quot;word&quot;&gt;{{ word }}&amp;#x3C;/div&gt;
    &amp;#x3C;div id=&quot;rubyword&quot; class=&quot;ruby-div&quot;&gt;{{ rubytextHtml }}&amp;#x3C;/div&gt;
&amp;#x3C;/div&gt;

&amp;#x3C;script&gt;
    if (document.getElementById(&apos;rubyword&apos;).innerHTML.trim().length &gt; 0) {
        document.getElementById(&apos;word&apos;).classList.add(&quot;hide-style&quot;);
    } else {
        document.getElementById(&apos;rubyword&apos;).classList.add(&quot;hide-style&quot;);
    }
&amp;#x3C;/script&gt;

&amp;#x3C;hr style=&quot;border: 0; border-top: 1px solid #ddd; margin: 10px 0;&quot;&gt;

&amp;#x3C;div id=&quot;example_sentence_container&quot; class=&quot;example-div&quot; onclick=&apos;playAudio(&quot;audio_sentence&quot;)&apos;&gt;
    {{#Sentence_With_Reading}}
        {{Sentence_With_Reading}}
    {{/Sentence_With_Reading}}
    
    {{^Sentence_With_Reading}}
        {{example_sentence}}
    {{/Sentence_With_Reading}}
&amp;#x3C;/div&gt;

&amp;#x3C;div id=&quot;image&quot; class=&quot;centerdiv&quot; style=&quot;margin-top: 10px;&quot;&gt;
    {{screenshot}}
&amp;#x3C;/div&gt;

&amp;#x3C;script&gt;
    function playAudio(audioId) {
        var audioDiv = document.getElementById(audioId);
        var audio = audioDiv.getElementsByTagName(&apos;*&apos;);
        if (audio.length &gt; 0) {
            audio[0].click();
        }
    }
    // 检查图片是否为空
    function checkhide2(eid) {
        var emptyDiv = document.getElementById(eid);
        if (emptyDiv &amp;#x26;&amp;#x26; emptyDiv.children.length == 0) {
            emptyDiv.classList.add(&quot;hide-style&quot;);
        }
    }
    checkhide2(&quot;image&quot;)
&amp;#x3C;/script&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;背面：&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;#x3C;div class=&quot;hide-style&quot;&gt;
    &amp;#x3C;div id=&quot;audio&quot;&gt;{{audio_for_word}}&amp;#x3C;/div&gt;
    &amp;#x3C;div id=&quot;audio_sentence&quot;&gt;{{audio_for_example_sentence}}&amp;#x3C;/div&gt;
&amp;#x3C;/div&gt;

&amp;#x3C;div class=&quot;centerdiv&quot; onclick=&apos;playAudio(&quot;audio&quot;)&apos;&gt;
    &amp;#x3C;div class=&quot;ruby-div&quot; id=&quot;word&quot;&gt;{{ word }}&amp;#x3C;/div&gt;
    &amp;#x3C;div id=&quot;rubyword&quot; class=&quot;ruby-div&quot;&gt;{{ rubytextHtml }}&amp;#x3C;/div&gt;
&amp;#x3C;/div&gt;

&amp;#x3C;script&gt;
    if (document.getElementById(&apos;rubyword&apos;).innerHTML.trim().length &gt; 0) {
        document.getElementById(&apos;word&apos;).classList.add(&quot;hide-style&quot;);
    } else {
        document.getElementById(&apos;rubyword&apos;).classList.add(&quot;hide-style&quot;);
    }
&amp;#x3C;/script&gt;

&amp;#x3C;hr style=&quot;border: 0; border-top: 1px solid #ddd; margin: 10px 0;&quot;&gt;

&amp;#x3C;div id=&quot;example_sentence_container&quot; class=&quot;example-div&quot; onclick=&apos;playAudio(&quot;audio_sentence&quot;)&apos;&gt;
    {{#Sentence_With_Reading}}
        {{Sentence_With_Reading}}
    {{/Sentence_With_Reading}}
    {{^Sentence_With_Reading}}
        {{example_sentence}}
    {{/Sentence_With_Reading}}
&amp;#x3C;/div&gt;

&amp;#x3C;div id=&quot;remarks&quot; class=&quot;centerdiv centertext remark-div&quot; style=&quot;color: #666; margin-top: 8px; font-weight: bold;&quot;&gt;
    {{remarks}}
&amp;#x3C;/div&gt;

{{#Word_Analysis}}
&amp;#x3C;div class=&quot;ai-analysis-container&quot;&gt;
    &amp;#x3C;div class=&quot;analysis-box&quot;&gt;
        &amp;#x3C;div class=&quot;analysis-title&quot;&gt;📖 词汇解析&amp;#x3C;/div&gt;
        &amp;#x3C;div class=&quot;analysis-content&quot;&gt;{{Word_Analysis}}&amp;#x3C;/div&gt;
    &amp;#x3C;/div&gt;
    
    &amp;#x3C;div class=&quot;analysis-box&quot;&gt;
        &amp;#x3C;div class=&quot;analysis-title&quot;&gt;💡 语法分析&amp;#x3C;/div&gt;
        &amp;#x3C;div class=&quot;analysis-content&quot;&gt;{{Grammar_Note}}&amp;#x3C;/div&gt;
    &amp;#x3C;/div&gt;
&amp;#x3C;/div&gt;
{{/Word_Analysis}}

{{#screenshot}}
&amp;#x3C;hr style=&quot;border: 0; border-top: 2px dashed #eee; margin: 20px 0;&quot;&gt;
{{/screenshot}}

&amp;#x3C;div id=&quot;image&quot; class=&quot;centerdiv&quot; style=&quot;margin-top: 5px;&quot;&gt;
    {{screenshot}}
&amp;#x3C;/div&gt;

&amp;#x3C;script&gt;
    function playAudio(audioId) {
        var audioDiv = document.getElementById(audioId);
        var audio = audioDiv.getElementsByTagName(&apos;*&apos;);
        if (audio.length &gt; 0) {
            audio[0].click();
        }
    }
    function checkhide(eid) {
        var emptyDiv = document.getElementById(eid);
        if (emptyDiv &amp;#x26;&amp;#x26; emptyDiv.innerText.trim() === &quot;&quot;) {
            emptyDiv.classList.add(&quot;hide-style&quot;);
        }
    }
    function checkhide2(eid) {
        var emptyDiv = document.getElementById(eid);
        if (emptyDiv &amp;#x26;&amp;#x26; emptyDiv.children.length == 0) {
            emptyDiv.classList.add(&quot;hide-style&quot;);
        }
    }
    checkhide(&quot;remarks&quot;)
    checkhide2(&quot;image&quot;)
&amp;#x3C;/script&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;样式：&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/* --- 原有样式保持不变 --- */
.hide-style { display: none; height: 0; width: 0; }
.centerdiv { display: flex; justify-content: center; align-items: center; flex-direction: column; }
.centertext { text-align: center; }
.centerdiv img { max-width: 100%; height: auto; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.remark-div { font-family: &quot;BIZ UDGothic&quot;, &quot;Microsoft YaHei&quot;, sans-serif; font-size: 20px; padding: 5px 20px; }
.ruby-div { font-family: &quot;BIZ UDGothic&quot;, sans-serif; font-size: 48px; cursor: pointer; margin-bottom: 10px; }
.mobile .ruby-div { font-size: 36px; }
.mobile .example-div { font-size: 20px; }

/* --- 新增/修改样式 --- */

.example-div {
    text-align: center;
    font-family: &quot;BIZ UDGothic&quot;, &quot;Yu Gothic&quot;, sans-serif;
    font-size: 24px;
    padding: 5px;
    line-height: 2.2; /* 增加行高，给注音留空间 */
}

/* 目标词高亮样式 (脚本会生成 span class=&quot;target-highlight&quot;) */
.target-highlight {
    color: #e55039; /* 鲜艳的红橙色 */
    font-weight: bold;
    border-bottom: 2px solid #e55039; /* 下划线增强提示 */
}

/* 优化 Ruby 标签显示 */
ruby {
    ruby-align: center;
}
rt {
    font-size: 0.6em; /* 注音字体改小一点，更精致 */
    color: #555;
    user-select: none; /* 防止复制时选中注音 */
}

/* AI 分析区域容器 */
.ai-analysis-container {
    margin-top: 20px;
    padding: 10px;
    border-top: 2px dashed #ddd;
    text-align: left; /* 分析文字左对齐，方便阅读 */
}

.analysis-box {
    margin-bottom: 15px;
    background-color: #f8f9fa; /* 浅灰背景 */
    border-radius: 8px;
    padding: 10px;
    border-left: 5px solid #4a69bd; /* 左侧色条 */
}

.analysis-title {
    font-weight: bold;
    color: #4a69bd;
    margin-bottom: 5px;
    font-size: 0.9em;
}

/* AI 分析区域容器 */
.ai-analysis-container {
    margin-top: 20px;
    padding: 10px;
    /* border-top: 2px dashed #ddd; */ /* 可以把这行注释掉，或者保留作为和例句的分割 */
    background-color: #fafafa; /* 稍微给整个分析区加个极淡的底色，区分更明显 */
    border-radius: 10px;
    text-align: left;
}

/* --- Night Mode (深色模式) 适配 --- */

/* 1. 基础文字颜色调整 */
.night_mode .example-div, 
.night_mode .remark-div, 
.night_mode .centertext {
    color: #e0e0e0; /* 灰白色，比纯白更护眼 */
}

/* 2. 目标词高亮调整 */
.night_mode .target-highlight {
    color: #ff7675; /* 将深红改为浅红/粉红，在黑底上更清晰 */
    border-bottom: 2px solid #ff7675;
}

/* 3. 注音 (Ruby) 颜色调整 */
.night_mode rt {
    color: #a4b0be; /* 浅灰蓝色，避免在黑底上看不见 */
}

/* 4. AI 分析容器背景调整 */
.night_mode .ai-analysis-container {
    background-color: rgba(255, 255, 255, 0.05); /* 极低透明度的白色，提亮背景 */
    border-top: 2px dashed #555; /* 分割线变暗 */
}

/* 5. 分析卡片 (Analysis Box) 调整 */
.night_mode .analysis-box {
    background-color: #2f3542; /* 深灰/深蓝背景，区别于全黑底色 */
    border-left: 5px solid #74b9ff; /* 左侧色条改为亮蓝色 */
    color: #dfe4ea; /* 框内文字颜色 */
}

/* 6. 分析标题调整 */
.night_mode .analysis-title {
    color: #74b9ff; /* 标题改为亮蓝色，与边框呼应 */
}

/* 7. 图片阴影调整 (可选) */
.night_mode .centerdiv img {
    box-shadow: 0 4px 8px rgba(0,0,0,0.5); /* 加深阴影，使其在深色背景稍微可见 */
    opacity: 0.9; /* (可选) 稍微降低图片亮度，防止夜间截图太刺眼 */
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;3. 用python脚本实现通过LLM模型实现对卡片的分析、更新&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;import requests
import json
import re

# ================= 配置区域 =================
# AnkiConnect 地址
ANKI_URL = &quot;http://localhost:8765&quot;

# OpenAI / 兼容 API 配置
API_KEY = &quot;你的API Key&quot;  # 替换为你的 API Key
BASE_URL = &quot;https://api.moonshot.cn/v1&quot;         # 如果是用其他服务商，请修改此处
MODEL_NAME = &quot;kimi-k2-0905-preview&quot;                          # 或 gpt-3.5-turbo, deepseek-chat 等

# 目标 Deck 名称 (可选，建议设置以缩小范围，设为 None 则搜索所有卡片)
TARGET_DECK = &quot;lunadeck&quot;
# ===========================================

def anki_invoke(action, **params):
    &quot;&quot;&quot;通用 AnkiConnect 调用函数&quot;&quot;&quot;
    request_json = {
        &quot;action&quot;: action,
        &quot;version&quot;: 6,
        &quot;params&quot;: params
    }
    try:
        response = requests.post(ANKI_URL, json=request_json).json()
        if len(response) != 2:
            raise Exception(&quot;Response has an unexpected number of fields.&quot;)
        if &quot;error&quot; not in response:
            raise Exception(&quot;Response is missing required error field.&quot;)
        if response[&quot;error&quot;] is not None:
            raise Exception(response[&quot;error&quot;])
        return response[&quot;result&quot;]
    except Exception as e:
        print(f&quot;AnkiConnect Error: {e}&quot;)
        return None

def clean_json_response(content):
    &quot;&quot;&quot;清理 LLM 可能返回的 Markdown 标记&quot;&quot;&quot;
    content = content.strip()
    if content.startswith(&quot;```&quot;):
        # 去掉第一行 ```json 和最后一行 ```
        content = re.sub(r&quot;^```[a-zA-Z]*\n&quot;, &quot;&quot;, content)
        content = re.sub(r&quot;\n```$&quot;, &quot;&quot;, content)
    return content.strip()

def generate_sentence_data(word, sentence):
    &quot;&quot;&quot;调用 OpenAI API 生成数据&quot;&quot;&quot;
    system_prompt = (
    &apos;你是一位专业的日语语言学教授。请根据用户提供的【单词】和【例句】，生成用于 Anki 学习的 JSON 数据。\n\n&apos;
    &apos;### 核心任务\n&apos;
    &apos;返回一个 JSON 对象，必须包含以下 4 个字段：\n\n&apos;
    &apos;1. &quot;sentence_html&quot;: \n&apos;
    &apos;   - 将例句转换为 HTML 格式。\n&apos;
    &apos;   - **核心规则**：必须为句中【每一个汉字】（无论多简单）都标注假名。\n&apos;
    &apos;     ❌ 错误：昼休み\n&apos;
    &apos;     ✅ 正确：&amp;#x3C;ruby&gt;昼&amp;#x3C;rt&gt;ひる&amp;#x3C;/rt&gt;&amp;#x3C;/ruby&gt;&amp;#x3C;ruby&gt;休&amp;#x3C;rt&gt;やす&amp;#x3C;/rt&gt;&amp;#x3C;/ruby&gt;み\n&apos;
    &apos;   - **高亮规则**：找到句中的【目标单词】（含变形），用 &amp;#x3C;span class=&quot;target-highlight&quot;&gt;...&amp;#x3C;/span&gt; 包裹。\n&apos;
    &apos;   - **排版规则**：&amp;#x3C;span class=&quot;target-highlight&quot;&gt; 必须在 &amp;#x3C;ruby&gt; 标签外部。送假名（如“り”）不要放在 rt 标签内。\n\n&apos;
    &apos;2. &quot;word_analysis&quot;:\n&apos;
    &apos;   - 用简洁的中文解释目标单词在句中的含义。\n&apos;
    &apos;   - 指出其词性（如：五段动词、N2级名词）及活用形式（如：て形、被动语态）。\n\n&apos;
    &apos;3. &quot;grammar_note&quot;:\n&apos;
    &apos;   - 分析句中出现的其他所有重要语法点或句型（不包含目标单词本身）。\n&apos;
    &apos;   - 返回 HTML 无序列表格式 (&amp;#x3C;ul&gt;&amp;#x3C;li&gt;...&amp;#x3C;/li&gt;&amp;#x3C;/ul&gt;)。\n&apos;
    &apos;   - 每个点要言简意赅，不要长篇大论。&apos;
)

    user_prompt = f&quot;单词: {word}\n例句: {sentence}&quot;

    headers = {
        &quot;Authorization&quot;: f&quot;Bearer {API_KEY}&quot;,
        &quot;Content-Type&quot;: &quot;application/json&quot;
    }
    
    payload = {
        &quot;model&quot;: MODEL_NAME,
        &quot;messages&quot;: [
            {&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: system_prompt},
            {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: user_prompt}
        ],
        &quot;response_format&quot;: {&quot;type&quot;: &quot;json_object&quot;}, # 强制 JSON 输出 (如果模型支持)
        &quot;temperature&quot;: 0.3
    }

    try:
        response = requests.post(f&quot;{BASE_URL}/chat/completions&quot;, headers=headers, json=payload)
        response.raise_for_status()
        result = response.json()
        content = result[&apos;choices&apos;][0][&apos;message&apos;][&apos;content&apos;]
        return json.loads(clean_json_response(content))
    except Exception as e:
        print(f&quot;API Request Error: {e}&quot;)
        return None

def main():
    # 1. 构建查询语句：查找 Sentence_With_Reading 为空的卡片
    query = &apos;&quot;Sentence_With_Reading:&quot;&apos;  # 在 Anki 中查找空字段
    if TARGET_DECK:
        query = f&apos;deck:&quot;{TARGET_DECK}&quot; {query}&apos;
    
    print(f&quot;正在查找符合条件的卡片 (Query: {query})...&quot;)
    note_ids = anki_invoke(&quot;findNotes&quot;, query=query)
    
    if not note_ids:
        print(&quot;没有找到需要更新的卡片。&quot;)
        return

    print(f&quot;找到 {len(note_ids)} 张卡片。准备开始处理...&quot;)
    
    # 2. 获取这些卡片的详细信息
    notes_info = anki_invoke(&quot;notesInfo&quot;, notes=note_ids)
    
    success_count = 0
    
    # 3. 遍历处理
    for note in notes_info:
        note_id = note[&apos;noteId&apos;]
        fields = note[&apos;fields&apos;]
        
        # 获取源字段
        word = fields.get(&apos;word&apos;, {}).get(&apos;value&apos;, &apos;&apos;).strip()
        sentence = fields.get(&apos;example_sentence&apos;, {}).get(&apos;value&apos;, &apos;&apos;).strip()
        
        # 简单校验
        if not word or not sentence:
            print(f&quot;[跳过] ID: {note_id} - 缺少单词或例句&quot;)
            continue
            
        print(f&quot;\n正在处理: {word} -&gt; {sentence[:15]}...&quot;)
        
        # 调用 AI
        ai_data = generate_sentence_data(word, sentence)
        
        if ai_data:
            # 准备更新的数据
            new_fields = {
                &quot;Sentence_With_Reading&quot;: ai_data.get(&quot;sentence_html&quot;, &quot;&quot;),
                &quot;Word_Analysis&quot;: ai_data.get(&quot;word_analysis&quot;, &quot;&quot;),
                &quot;Grammar_Note&quot;: ai_data.get(&quot;grammar_note&quot;, &quot;&quot;)
            }
            
            # 4. 更新 Anki
            result = anki_invoke(&quot;updateNoteFields&quot;, note={&quot;id&quot;: note_id, &quot;fields&quot;: new_fields})
            
            if result is None: # updateNoteFields 返回 null 表示成功，只要不报错
                print(f&quot;   [成功] 已更新卡片 {note_id}&quot;)
                success_count += 1
            else:
                # AnkiConnect updateNoteFields 成功时通常返回 None (null)
                # 如果有返回值且不是 error，这里视为一种确认
                print(f&quot;   [成功] 已更新卡片 {note_id}&quot;)
                success_count += 1
        else:
            print(f&quot;   [失败] AI 未返回有效数据&quot;)

    print(f&quot;\n处理完成。共更新 {success_count}/{len(note_ids)} 张卡片。&quot;)
    # 刷新 Anki 界面以便立即看到更改
    anki_invoke(&quot;guiBrowse&quot;, query=query)

if __name__ == &quot;__main__&quot;:
    main()
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;</content:encoded><h:img src="/_astro/Luna.mZrDWPsM.png"/><enclosure url="/_astro/Luna.mZrDWPsM.png"/></item><item><title>留学做饭入坑记录</title><link>https://astro-pure.js.org/blog/cooking/learn_to_cook</link><guid isPermaLink="true">https://astro-pure.js.org/blog/cooking/learn_to_cook</guid><description>人是铁，饭是钢</description><pubDate>Sat, 31 Jan 2026 19:39:00 GMT</pubDate><content:encoded>&lt;p&gt;出来交换一学期，感觉厨艺确实能上涨不少。国内外卖和食堂实在是太方便和便宜。到了新加坡才发现好吃又便宜的饭找不到了，之只能自己做。&lt;/p&gt;
&lt;p&gt;我之前几乎没有做饭经验，这篇博客主要记录一些厨房做饭知识、菜谱，帮助我作出更多好吃的漂亮饭。&lt;/p&gt;
&lt;h1&gt;1. 食材保存&lt;/h1&gt;
&lt;p&gt;食材保存肯定是重中之重，既关系到一餐的成本，又牵扯到食品安全。&lt;/p&gt;
&lt;h2&gt;1. 蔬菜&lt;/h2&gt;
&lt;p&gt;| 食材 | 保存方法 |
|----|------|
|    |      |
|    |      |
|    |      |&lt;/p&gt;
&lt;h2&gt;2. 肉&lt;/h2&gt;
&lt;p&gt;| 食材 | 保存方法                                                     |
| ---- | ------------------------------------------------------------ |
| 鸡蛋 | 首先参考包装上的“Use By”；放在冰箱可以存4-5周，常温2周，但是建议7-10周内吃完；判断方法——可以将鸡蛋放入冷水，浮起来说明进了太多空气，不可食用；沉到底部但是立起来，不算最新鲜，但是可以食用。 |
|      |                                                              |
|      |                                                              |&lt;/p&gt;
&lt;h2&gt;3. 水果&lt;/h2&gt;
&lt;p&gt;| 食材 | 保存方法                                                |
|----|-----------------------------------------------------|
| 香蕉 | 可以直接放在室温下，等到熟了（可以轻松掰开皮，或者香蕉完全没有涩味，只有熟甜味），就可以放入冷藏层了。 |
|    |                                                     |
|    |                                                     |&lt;/p&gt;
&lt;h2&gt;4. 海鲜&lt;/h2&gt;
&lt;p&gt;| 食材 | 保存方法 |
|----|------|
|    |      |
|    |      |
|    |      |&lt;/p&gt;
&lt;h2&gt;5. 其它&lt;/h2&gt;
&lt;p&gt;| 食材            | 保存方法                                                     |
| --------------- | ------------------------------------------------------------ |
| Nutella(涂抹酱) | 存放在阴凉干燥处。不要冷藏，含有大量油脂，放入冰箱后会变得非常坚硬，完全刷不开。如果是&lt;strong&gt;纯天然、无添加剂的花生酱&lt;/strong&gt;（摇晃起来稀稀的那种），才需要冷藏防止油脂酸败。但这瓶 Nutella 含有乳化剂，室温存放非常稳定。开盖后只要保持清洁（每次都用干净、干燥的勺子挖），它在室温下放到包装上的保质期结束通常都没问题。 |
| 吐司面包        | 首选：阴凉干燥处。如果能在 &lt;strong&gt;3-5 天&lt;/strong&gt;内吃完，可以存放&lt;strong&gt;5-7 天&lt;/strong&gt;。次选：冷冻层（Freezer）。直接丢进&lt;strong&gt;冷冻层&lt;/strong&gt;，吃的时候用烤箱或微波炉加热，口感能恢复到 90% 以上，可以存放 &lt;strong&gt;1-2 个月&lt;/strong&gt;。千万不要放冷藏层（Chiller）：冰箱冷藏室的温度会加速面包中淀粉的“老化”（retrogradation），让面包迅速变干、变硬，口感变得像纸壳一样。 |
|                 |                                                              |&lt;/p&gt;</content:encoded><h:img src="/_astro/food.wiU_gqf6.jpg"/><enclosure url="/_astro/food.wiU_gqf6.jpg"/></item><item><title>博客美化技巧</title><link>https://astro-pure.js.org/blog/blog/tricks</link><guid isPermaLink="true">https://astro-pure.js.org/blog/blog/tricks</guid><description>Astro Pure博客美化技巧。</description><pubDate>Sat, 31 Jan 2026 15:12:00 GMT</pubDate><content:encoded>&lt;p&gt;import { Aside } from &apos;astro-pure/user&apos;&lt;/p&gt;
&lt;p&gt;记录在这个主题博客写作的一些技巧：&lt;/p&gt;
&lt;p&gt;官方介绍链接：&lt;a href=&quot;https://astro-pure.js.org/docs/setup/getting-started&quot;&gt;Astro Theme Pure&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;1. Aside美化&lt;/h1&gt;
&lt;p&gt;{/* 1. 笔记 (蓝色) */}&lt;/p&gt;
&lt;p&gt;{/* 2. 提示 (绿色) - 你现在的这个 */}&lt;/p&gt;
&lt;p&gt;{/* 3. 警告 (黄色) */}&lt;/p&gt;
&lt;p&gt;{/* 4. 危险 (红色) */}&lt;/p&gt;</content:encoded><h:img src="/_astro/OIP.Ch4BCprN.webp"/><enclosure url="/_astro/OIP.Ch4BCprN.webp"/></item><item><title>CS2030DE笔记-Programming Methodology II</title><link>https://astro-pure.js.org/blog/cs2030de/cs2030de%E7%AC%94%E8%AE%B0</link><guid isPermaLink="true">https://astro-pure.js.org/blog/cs2030de/cs2030de%E7%AC%94%E8%AE%B0</guid><description>Java 报错笔记。</description><pubDate>Sat, 31 Jan 2026 15:02:00 GMT</pubDate><content:encoded>&lt;p&gt;2026春季学期在新加坡国立大学交换，上了CS2030DE-Programming Methodology II。主要是通过Java将一些软件工程的基础，比如继承，接口，泛型之类的知识。虽然我好像也不会太用到Java（我目前更喜欢Go），但是这也估计是本科四年里难得正儿八经上的编程课。&lt;/p&gt;
&lt;p&gt;这个课程笔记主要记录初学Java的一些报错，希望以后能注意到。&lt;/p&gt;
&lt;h1&gt;1. 关于java.util.ArrayList&lt;/h1&gt;
&lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;ArrayList&amp;#x3C;Double&gt; normalized_data = new ArrayList&amp;#x3C;&gt;(listlen);
for (int i = 0; i &amp;#x3C; listlen; i++) {
    normalized_data.set(i, ...); // 这里报错！
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;开始误以为：&lt;code&gt;new ArrayList&amp;#x3C;&gt;(listlen)&lt;/code&gt; 创建了一个长度为 &lt;code&gt;listlen&lt;/code&gt; 的数组。&lt;/p&gt;
&lt;p&gt;实际上：括号里的 &lt;code&gt;listlen&lt;/code&gt; 只是 &lt;strong&gt;初始容量 (Initial Capacity)&lt;/strong&gt;，它告诉 Java “请预留这么多空间”。此时 &lt;code&gt;ArrayList&lt;/code&gt; 的 &lt;strong&gt;实际大小 (size)&lt;/strong&gt; 仍然是 &lt;strong&gt;0&lt;/strong&gt;。在 Java 中，你不能 &lt;code&gt;set&lt;/code&gt; 一个尚未存在的位置。&lt;/p&gt;
&lt;p&gt;解决方法：使用 &lt;code&gt;add()&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-Java&quot;&gt;ArrayList&amp;#x3C;Double&gt; normalized_data = new ArrayList&amp;#x3C;&gt;(listlen); // 预留空间是个好习惯
for (int i = 0; i &amp;#x3C; listlen; i++) {
    double value = (data.get(i) - mean) / std;
    normalized_data.add(value); // 使用 add() 自动增加 size
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h1&gt;2. 关于this关键字&lt;/h1&gt;
&lt;h2&gt;a. 一些bug排查&lt;/h2&gt;
&lt;h2&gt;1. IntellJ IDE无法提供基本代码提示（像 &lt;code&gt;String&lt;/code&gt;, &lt;code&gt;public&lt;/code&gt;, &lt;code&gt;List&lt;/code&gt; 这种 Java 核心库和关键字）&lt;/h2&gt;
&lt;p&gt;这个问题在没网的lab真的很抓狂，经过检查是第三种错误，没有添加Sources Root文件夹。&lt;/p&gt;
&lt;h3&gt;1. 检查是否开启了 &quot;省电模式&quot; (Power Save Mode)&lt;/h3&gt;
&lt;p&gt;这是最常见但也最容易被忽视的原因。如果开启了这个模式，IDE 会关闭所有的自动代码分析和提示以节省电量。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;**检查方法：**看 IDE 窗口右下角是否有一个带着小电池图标的标志，或者直接去菜单栏检查。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;操作：&lt;/strong&gt; 点击 &lt;code&gt;File&lt;/code&gt; (文件) -&gt; 确认 &lt;strong&gt;&lt;code&gt;Power Save Mode&lt;/code&gt;&lt;/strong&gt; 没有被勾选。&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;2. 检查 Project SDK (JDK) 是否配置&lt;/h3&gt;
&lt;p&gt;如果 IDE 不知道你用的是哪个版本的 Java，它就无法加载 &lt;code&gt;String&lt;/code&gt; 这些基础类，自然也就没有提示。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;操作：&lt;/strong&gt;
&lt;ol&gt;
&lt;li&gt;按快捷键 &lt;code&gt;Ctrl + Alt + Shift + S&lt;/code&gt; (或者点击 &lt;code&gt;File&lt;/code&gt; -&gt; &lt;code&gt;Project Structure&lt;/code&gt;)。&lt;/li&gt;
&lt;li&gt;在左侧选择 &lt;strong&gt;&lt;code&gt;Project&lt;/code&gt;&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;查看 &lt;strong&gt;&lt;code&gt;SDK&lt;/code&gt;&lt;/strong&gt; 这一栏。如果是 &lt;code&gt;&amp;#x3C;No SDK&gt;&lt;/code&gt; 或者红色的，说明这就因。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;解决：&lt;/strong&gt; 下拉选择一个你本地安装的 JDK（Lab 电脑上通常会预装）。如果列表里没有，点击 &lt;code&gt;Add SDK&lt;/code&gt; -&gt; &lt;code&gt;JDK&lt;/code&gt;，然后找到电脑上安装 JDK 的目录（通常在 &lt;code&gt;C:\Program Files\Java\...&lt;/code&gt; 或 &lt;code&gt;/usr/lib/jvm/...&lt;/code&gt;）。&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;3. 检查 &quot;Sources Root&quot; (源代码根目录)&lt;/h3&gt;
&lt;p&gt;这是新手最容易遇到的坑。如果你的 Java 文件所在的文件夹图标是&lt;strong&gt;灰色&lt;/strong&gt;的（普通文件夹），而不是&lt;strong&gt;蓝色&lt;/strong&gt;的（Source Root），IDE 就不会去编译和分析里面的代码。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;现象：&lt;/strong&gt; 打开 Java 文件，发现左上角的图标是一个橘红色的 &apos;J&apos; 都在圆圈里，或者文件内容全是白色，关键字没有变色高亮。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;解决：&lt;/strong&gt;
&lt;ol&gt;
&lt;li&gt;在左侧项目视图（Project View）中，找到你存放代码的文件夹（比如 &lt;code&gt;src&lt;/code&gt;）。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;右键点击&lt;/strong&gt; 该文件夹。&lt;/li&gt;
&lt;li&gt;选择 &lt;strong&gt;&lt;code&gt;Mark Directory as&lt;/code&gt;&lt;/strong&gt; (将目录标记为) -&gt; &lt;strong&gt;&lt;code&gt;Sources Root&lt;/code&gt;&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;此时文件夹图标应该变蓝，代码提示通常会立即恢复。&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;进阶：&lt;/strong&gt;
&lt;ol&gt;
&lt;li&gt;如果还是不行，按下快捷键 &lt;code&gt;Ctrl + Alt + Shift + S&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;在左侧选择 &lt;strong&gt;Modules&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;选择 &lt;strong&gt;新建模块 (New Module)&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;之后再按照上面标记为源代码根目录。&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;b. java语言切换&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Java 安装包本身通常不分“中文版”或“英文版”&lt;/strong&gt;。Java 虚拟机 (JVM) 会自动读取你的操作系统语言设置（Locale）。如果你的 Windows 是中文环境，Java 输出（如报错信息、&lt;code&gt;java -version&lt;/code&gt; 信息）通常会自动显示为中文。&lt;/p&gt;
&lt;p&gt;永久切换：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-powershell&quot;&gt;[System.Environment]::SetEnvironmentVariable(&quot;JAVA_TOOL_OPTIONS&quot;, &quot;-Duser.language=en -Duser.country=US&quot;, &quot;User&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;当前会话临时切换：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-powershell&quot;&gt;$env:JAVA_TOOL_OPTIONS = &quot;-Duser.language=en -Duser.country=US&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;恢复默认：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-powershell&quot;&gt;[System.Environment]::SetEnvironmentVariable(&quot;JAVA_TOOL_OPTIONS&quot;, $null, &quot;User&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;指定中文：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-powershell&quot;&gt;[System.Environment]::SetEnvironmentVariable(&quot;JAVA_TOOL_OPTIONS&quot;, &quot;-Duser.language=zh -Duser.country=CN&quot;, &quot;User&quot;)
&lt;/code&gt;&lt;/pre&gt;</content:encoded><h:img src="/_astro/Java-Logo-history.ER0BSmkC.jpg"/><enclosure url="/_astro/Java-Logo-history.ER0BSmkC.jpg"/></item><item><title>Tips to improve concentration</title><link>https://astro-pure.js.org/blog/improve-concentration</link><guid isPermaLink="true">https://astro-pure.js.org/blog/improve-concentration</guid><description>Mindfulness, cognitive training, and a healthy lifestyle may help sharpen your focus.</description><pubDate>Sat, 10 May 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;import { Aside } from &apos;astro-pure/user&apos;&lt;/p&gt;
&lt;p&gt;You&apos;re trying to concentrate, but your mind is wandering or you&apos;re easily distracted. What happened to the laser-sharp focus you once enjoyed? As we age, we tend to have more difficulty filtering out stimuli that are not relevant to the task at hand.&lt;/p&gt;
&lt;h2&gt;What&apos;s fogging up focus?&lt;/h2&gt;
&lt;p&gt;Like a computer that slows with use, the brain accumulates wear and tear that affects processing. This can be caused by a number of physiological stressors such as inflammation, injury to blood vessels (especially if you have high blood pressure), the buildup of abnormal proteins, and naturally occurring brain shrinkage.&lt;/p&gt;
&lt;p&gt;The following factors can also affect your concentration.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Underlying conditions.&lt;/strong&gt; Depression or sleep disorders (such as sleep apnea) can undermine your ability to concentrate. So can the effects of vision or hearing loss. You waste precious cognitive resources when you spend too much time trying to make out what&apos;s written on a page or just hear what someone is saying.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Medication side effects.&lt;/strong&gt; Some drugs, especially anticholinergics (such as treatments for incontinence, depression, or allergies), can slow processing speed and your ability to think clearly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Excessive drinking.&lt;/strong&gt; Having too much alcohol impairs thinking and causes interrupted sleep, which affects concentration.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Information overload.&lt;/strong&gt; We are bombarded with information from TVs, computers, and messages such as texts or emails. When there&apos;s too much material, it burdens our filtering system and it&apos;s easy to get distracted.&lt;/p&gt;
&lt;h2&gt;Strategies to stay focused&lt;/h2&gt;
&lt;p&gt;To improve attention, consider the following strategies.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Mindfulness.&lt;/strong&gt; &quot;Mindfulness is about focusing attention on the present moment, and practicing mindfulness has been shown to rewire the brain so that attention is stronger in everyday life,&quot; says Kim Willment, a neuropsychologist with Brigham and Women&apos;s Hospital. She recommends sitting still for a few minutes each day, closing your eyes, and focusing on your breathing as well as the sounds and sensations around you.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cognitive training.&lt;/strong&gt; Computerized cognitive training games aim to improve your response times and attention. Evidence that this works has been mixed. &quot;The goal of playing these games is not to get better at them, but to get better in the cognitive activities of everyday life,&quot; Willment says. &quot;But there is evidence that a person&apos;s ability to pay attention can be improved by progressively pushing the person to higher levels of performance. So if you reach a certain level of sustained attention, pushing it to the next level can help improve it, and this may translate to everyday life.&quot;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A healthier lifestyle.&lt;/strong&gt; Many aspects of a healthy lifestyle can help attention, starting with sleep and exercise. There is a direct link between exercise and cognitive ability, especially attention. When you exercise, you increase the availability of brain chemicals that promote new brain connections, reduce stress, and improve sleep. And when we sleep, we reduce stress hormones that can be harmful to the brain, and we clear out proteins that injure it.&lt;/p&gt;
&lt;p&gt;Aim for seven to eight hours of sleep each night, and 150 minutes per week of aerobic exercise, such as brisk walking.&lt;/p&gt;
&lt;p&gt;Other healthy steps to improve focus: eat a Mediterranean-style diet, which has been shown to support brain health; treat underlying conditions; and change medications that may be affecting your ability to focus.&lt;/p&gt;
&lt;p&gt;Getting older is out of your control, but healthier living is something you determine, and it may improve concentration.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Article from: &lt;a href=&quot;https://www.health.harvard.edu/mind-and-mood/tips-to-improve-concentration&quot;&gt;Harvard Health Publishing&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;</content:encoded><h:img src="/_astro/thumbnail.1GZ294Dz.jpg"/><enclosure url="/_astro/thumbnail.1GZ294Dz.jpg"/></item><item><title>Using MDX</title><link>https://astro-pure.js.org/blog/using-mdx</link><guid isPermaLink="true">https://astro-pure.js.org/blog/using-mdx</guid><description>Learning how to use MDX in Astro</description><pubDate>Sun, 01 Jun 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;This theme comes with the &lt;a href=&quot;https://docs.astro.build/en/guides/integrations-guide/mdx/&quot;&gt;@astrojs/mdx&lt;/a&gt; integration installed and configured in your &lt;code&gt;astro.config.ts&lt;/code&gt; config file. If you prefer not to use MDX, you can disable support by removing the integration from your config file.&lt;/p&gt;
&lt;h2&gt;Why MDX?&lt;/h2&gt;
&lt;p&gt;MDX is a special flavor of Markdown that supports embedded JavaScript &amp;#x26; JSX syntax. This unlocks the ability to &lt;a href=&quot;https://docs.astro.build/en/guides/markdown-content/#mdx-features&quot;&gt;mix JavaScript and UI Components into your Markdown content&lt;/a&gt; for things like interactive charts or alerts.&lt;/p&gt;
&lt;p&gt;If you have existing content authored in MDX, this integration will hopefully make migrating to Astro a breeze.&lt;/p&gt;
&lt;h2&gt;Example&lt;/h2&gt;
&lt;p&gt;Here is how you import and use a UI component inside of MDX.&lt;br&gt;
When you open this page in the browser, you should see the clickable button below.&lt;/p&gt;
&lt;p&gt;import { Button } from &apos;astro-pure/user&apos;&lt;/p&gt;
&lt;p&gt;Click Me&lt;/p&gt;
&lt;h2&gt;More Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://mdxjs.com/docs/what-is-mdx&quot;&gt;MDX Syntax Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.astro.build/en/guides/markdown-content/#markdown-and-mdx-pages&quot;&gt;Astro Usage Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;a href=&quot;https://docs.astro.build/en/reference/directives-reference/#client-directives&quot;&gt;Client Directives&lt;/a&gt; are still required to create interactive components. Otherwise, all components in your MDX will render as static HTML (no JavaScript) by default.&lt;/li&gt;
&lt;/ul&gt;</content:encoded><h:img src="undefined"/><enclosure url="undefined"/></item><item><title>What Is 3D Rendering? Complete Guide to 3D Visualization</title><link>https://astro-pure.js.org/blog/3d-rendering</link><guid isPermaLink="true">https://astro-pure.js.org/blog/3d-rendering</guid><description>3D imagery has the power to bring cinematic visions to life and help accurately plan tomorrow’s cityscapes. Here, 3D expert Ricardo Ortiz explains how it works.</description><pubDate>Sun, 09 Feb 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;3D rendering is all around us. From huge action movies to car commercials to previews of upcoming buildings or product designs, 3D visualization has become so widespread and realistic that you probably don’t even know it’s there.&lt;/p&gt;
&lt;p&gt;In this introductory piece, Chaos’ Ricardo Ortiz explains the basics of 3D rendering, from the computational methods that create imagery to the artistic techniques that create great computer-generated (CG) content and its various uses.&lt;/p&gt;
&lt;h2&gt;What is 3D Rendering?&lt;/h2&gt;
&lt;p&gt;Put simply, 3D rendering is the process of using a computer to generate a 2D image from a digital three-dimensional scene.&lt;/p&gt;
&lt;p&gt;To generate an image, specific methodologies and special software and hardware are used. Therefore, we need to understand that 3D rendering is a process—the one that builds the image.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://astro-pure.js.org/_image?href=%2F_astro%2Fnikola-arsov-still-life-interior-design-vray-3ds-max-05-930px.DoY3_oVo.jpg&amp;#x26;w=1920&amp;#x26;h=1280&amp;#x26;f=webp&quot; alt=&quot;alt text&quot;&gt;&lt;/p&gt;
&lt;h2&gt;Types of 3D rendering&lt;/h2&gt;
&lt;p&gt;We can create different types of rendered image; they can be realistic or non-realistic.&lt;/p&gt;
&lt;p&gt;A realistic image could be an architectural interior that looks like a photograph, a product-design image such as a piece of furniture, or an automotive rendering of a car. On the other hand, we can create a non-realistic image such as an outline-type diagram or a cartoon-style image with a traditional 2D look. Technically, we can visualize anything we can imagine.&lt;/p&gt;
&lt;h2&gt;How is 3D rendering used?&lt;/h2&gt;
&lt;p&gt;3D rendering is an essential technique for many industries including architecture, product design, advertising, video games and visual effects for film, TV and animation.&lt;/p&gt;
&lt;p&gt;In design and architecture, renders allow creative people to communicate their ideas in a clear and transparent way. A render gives them the chance to evaluate their proposals, experiment with materials, conduct studies and contextualize their designs in the real world before they are built or manufactured.&lt;/p&gt;
&lt;p&gt;For the media and entertainment industries, 3D rendering is fundamental to the creation of sequences and animations that tell stories, whether we’re watching an animated movie, a period drama, or an action sequence with explosions, ships from the future, exotic locales, or extraterrestrial creatures.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://astro-pure.js.org/_image?href=%2F_astro%2Fthanos-dd-single-image-004a.DUX4VGf-.jpg&amp;#x26;w=1920&amp;#x26;h=993&amp;#x26;f=webp&quot; alt=&quot;alt text&quot;&gt;&lt;/p&gt;
&lt;p&gt;Over the past few years, the evolution of computer graphics in these industries has replaced traditional techniques. For example, special effects are being replaced by visual effects, which means stunt people no longer risk their lives in car crashes.&lt;/p&gt;
&lt;p&gt;In advertising, I would dare to say that 90% of automotive commercials are CG—or even more. In the architecture industry, many traditional techniques to create representations, such as scale models, have been replaced with photorealistic imagery to ensure we can see exactly how something will look once it’s built.&lt;/p&gt;
&lt;p&gt;Accelerating processes, reducing costs and the demand for better quality results have helped technology evolve. Hardware is more powerful than ever and the switch to CG was inevitable.&lt;/p&gt;
&lt;h2&gt;How is a 3D rendered image generated?&lt;/h2&gt;
&lt;p&gt;Two pieces of software, with different characteristics, are used to computer-generate images and animations: render engines and game engines. Render engines use a technique called ray tracing, while game engines use a technique called rasterization—and some engines mix both techniques, but we will talk about that later on.&lt;/p&gt;</content:encoded><h:img src="/_astro/thumbnail.DzZDiYKA.jpg"/><enclosure url="/_astro/thumbnail.DzZDiYKA.jpg"/></item><item><title>The Impact of Technology on the Music World</title><link>https://astro-pure.js.org/blog/music-journey</link><guid isPermaLink="true">https://astro-pure.js.org/blog/music-journey</guid><description>The evolution of music is a symphony of creativity, rhythm, and technology.</description><pubDate>Sat, 30 Nov 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The evolution of music is a symphony of creativity, rhythm, and technology. From the humble beginnings of acoustic instruments to the present-day digital era, the relationship between music and technology has been transformative. In this article, we will explore the historical milestones, digital revolution, and emerging technologies that have shaped the music world. Join us on a journey through the chords of innovation as we discuss how technology has changed music.&lt;/p&gt;
&lt;h2&gt;Historical Perspective&lt;/h2&gt;
&lt;p&gt;The marriage of music and technology dates back centuries, with pivotal moments shaping the industry. The invention of the phonograph by Thomas Edison in the late 19th century marked the first time music could be recorded and replayed. Subsequent milestones, such as the electric guitar and the synthesizer, revolutionized music creation, paving the way for new genres and sounds.&lt;/p&gt;
&lt;p&gt;These technological leaps didn&apos;t merely shape the musical landscape of their time but laid a foundation for the continuous evolution of the intersection between music and technology. As artists embraced these innovations, they unlocked new avenues for creativity, paving the way for diverse sounds and genres that have become integral to the vibrant tapestry of the modern music industry. The historical perspective illuminates the symbiotic relationship between music and technology, highlighting the transformative impact that each innovation has had on the way we create, consume, and experience music.&lt;/p&gt;
&lt;h2&gt;Digital Revolution&lt;/h2&gt;
&lt;p&gt;The digital revolution has been a seismic shift in the music industry, altering how music is consumed, distributed, and produced. The transition from physical formats like CDs and vinyl to digital formats such as MP3s and streaming services has democratized access to music. The ease of streaming has transformed how listeners discover and enjoy music, challenging traditional revenue models while offering unparalleled convenience.&lt;/p&gt;
&lt;h2&gt;Technology in Music Consumption and Distribution&lt;/h2&gt;
&lt;p&gt;Streaming services have become the heartbeat of music consumption, causing a decline in traditional music stores. The accessibility of music online has reshaped distribution channels, impacting both artists and record labels. While it provides exposure to a global audience, it also poses challenges regarding fair compensation for artists. The dynamics of the industry are evolving, reflecting the intricate dance between technology and music.
Music Production and Creation&lt;/p&gt;
&lt;p&gt;The advent of digital audio workstations (DAWs), software instruments, and electronic production techniques has democratized music creation. Artists now have powerful tools at their fingertips, enabling them to experiment with sounds, collaborate remotely, and produce music independently. This technological shift has broken down barriers, allowing for a diverse array of voices to be heard in the ever-expanding realm of music.&lt;/p&gt;</content:encoded><h:img src="/_astro/thumbnail.Cx18cRmB.jpg"/><enclosure url="/_astro/thumbnail.Cx18cRmB.jpg"/></item><item><title>Markdown Syntax Support</title><link>https://astro-pure.js.org/blog/markdown</link><guid isPermaLink="true">https://astro-pure.js.org/blog/markdown</guid><description>Markdown is a lightweight markup language.</description><pubDate>Wed, 26 Jul 2023 08:00:00 GMT</pubDate><content:encoded>&lt;h2&gt;Basic Syntax&lt;/h2&gt;
&lt;p&gt;Markdown is a lightweight and easy-to-use syntax for styling your writing.&lt;/p&gt;
&lt;h3&gt;Headers&lt;/h3&gt;
&lt;p&gt;When the content of the article is extensive, you can use headers to segment:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;# Header 1

## Header 2

## Large Header

### Small Header
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Header previews would disrupt the structure of the article, so they are not displayed here.&lt;/p&gt;
&lt;h3&gt;Bold and Italics&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;_Italic text_ and **Bold text**, together will be **_Bold Italic text_**
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Italic text&lt;/em&gt; and &lt;strong&gt;Bold text&lt;/strong&gt;, together will be &lt;strong&gt;&lt;em&gt;Bold Italic text&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;Links&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;Text link [Link Name](http://link-url)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;p&gt;Text link &lt;a href=&quot;http://link-url&quot;&gt;Link Name&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Inline Code&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;This is an `inline code`
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;p&gt;This is an &lt;code&gt;inline code&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;Code Blocks&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;```js
// calculate fibonacci
function fibonacci(n) {
  if (n &amp;#x3C;= 1) return 1
  const result = fibonacci(n - 1) + fibonacci(n - 2) // [\!code --]
  return fibonacci(n - 1) + fibonacci(n - 2) // [\!code ++]
}
```
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;// calculate fibonacci
function fibonacci(n) {
  if (n &amp;#x3C;= 1) return 1
  const result = fibonacci(n - 1) + fibonacci(n - 2) // [!code --]
  return fibonacci(n - 1) + fibonacci(n - 2) // [!code ++]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Currently using shiki as the code highlighting plugin. For supported languages, refer to &lt;a href=&quot;https://shiki.matsu.io/languages.html&quot;&gt;Shiki: Languages&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Inline Formula&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;This is an inline formula $e^{i\pi} + 1 = 0$
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;p&gt;This is an inline formula $e^{i\pi} + 1 = 0$&lt;/p&gt;
&lt;h3&gt;Formula Blocks&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;$$
\hat{f}(\xi) = \int_{-\infty}^{\infty} f(x) e^{-2\pi i x \xi} \, dx
$$
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;p&gt;$$
\hat{f}(\xi) = \int_{-\infty}^{\infty} f(x) e^{-2\pi i x \xi} , dx
$$&lt;/p&gt;
&lt;p&gt;Currently using KaTeX as the math formula plugin. For supported syntax, refer to &lt;a href=&quot;https://katex.org/docs/supported.html&quot;&gt;KaTeX Supported Functions&lt;/a&gt;.&lt;/p&gt;
&lt;h4&gt;Images&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;![CWorld](https://cravatar.cn/avatar/1ffe42aa45a6b1444a786b1f32dfa8aa?s=200)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cravatar.cn/avatar/1ffe42aa45a6b1444a786b1f32dfa8aa?s=200&quot; alt=&quot;CWorld&quot;&gt;&lt;/p&gt;
&lt;h4&gt;Strikethrough&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;~~Strikethrough~~
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;p&gt;~~Strikethrough~~&lt;/p&gt;
&lt;h3&gt;Lists&lt;/h3&gt;
&lt;p&gt;Regular unordered list&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;- 1
- 2
- 3
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1&lt;/li&gt;
&lt;li&gt;2&lt;/li&gt;
&lt;li&gt;3&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Regular ordered list&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;1. GPT-4
2. Claude Opus
3. LLaMa
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;GPT-4&lt;/li&gt;
&lt;li&gt;Claude Opus&lt;/li&gt;
&lt;li&gt;LLaMa&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can continue to nest syntax within lists.&lt;/p&gt;
&lt;h3&gt;Blockquotes&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;&gt; Gunshot, thunder, sword rise. A scene of flowers and blood.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Gunshot, thunder, sword rise. A scene of flowers and blood.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You can continue to nest syntax within blockquotes.&lt;/p&gt;
&lt;h3&gt;Line Breaks&lt;/h3&gt;
&lt;p&gt;Markdown needs a blank line to separate paragraphs.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;If you don&apos;t leave a blank line
it will be in one paragraph

First paragraph

Second paragraph
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;p&gt;If you don&apos;t leave a blank line
it will be in one paragraph&lt;/p&gt;
&lt;p&gt;First paragraph&lt;/p&gt;
&lt;p&gt;Second paragraph&lt;/p&gt;
&lt;h3&gt;Separators&lt;/h3&gt;
&lt;p&gt;If you have the habit of writing separators, you can start a new line and enter three dashes &lt;code&gt;---&lt;/code&gt; or asterisks &lt;code&gt;***&lt;/code&gt;. Leave a blank line before and after when there are paragraphs:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;---
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;Advanced Techniques&lt;/h2&gt;
&lt;h3&gt;Inline HTML Elements&lt;/h3&gt;
&lt;p&gt;Currently, only some inline HTML elements are supported, including &lt;code&gt;&amp;#x3C;kdb&gt; &amp;#x3C;b&gt; &amp;#x3C;i&gt; &amp;#x3C;em&gt; &amp;#x3C;sup&gt; &amp;#x3C;sub&gt; &amp;#x3C;br&gt;&lt;/code&gt;, such as&lt;/p&gt;
&lt;h4&gt;Key Display&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;Use &amp;#x3C;kbd&gt;Ctrl&amp;#x3C;/kbd&gt; + &amp;#x3C;kbd&gt;Alt&amp;#x3C;/kbd&gt; + &amp;#x3C;kbd&gt;Del&amp;#x3C;/kbd&gt; to reboot the computer
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;p&gt;Use Ctrl + Alt + Del to reboot the computer&lt;/p&gt;
&lt;h4&gt;Bold Italics&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;&amp;#x3C;b&gt; Markdown also applies here, such as _bold_ &amp;#x3C;/b&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;p&gt; Markdown also applies here, such as &lt;em&gt;bold&lt;/em&gt; &lt;/p&gt;
&lt;h3&gt;Other HTML Writing&lt;/h3&gt;
&lt;h4&gt;Foldable Blocks&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;&amp;#x3C;details&gt;&amp;#x3C;summary&gt;Click to expand&amp;#x3C;/summary&gt;It is hidden&amp;#x3C;/details&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;h3&gt;Tables&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;| Header1  | Header2  |
| -------- | -------- |
| Content1 | Content2 |
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;p&gt;| Header1  | Header2  |
| -------- | -------- |
| Content1 | Content2 |&lt;/p&gt;
&lt;h3&gt;Footnotes&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;Use [^footnote] to add a footnote at the point of reference.

Then, at the end of the document, add the content of the footnote (it will be rendered at the end of the article by default).

[^footnote]: Here is the content of the footnote
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;p&gt;Use [^footnote] to add a footnote at the point of reference.&lt;/p&gt;
&lt;p&gt;Then, at the end of the document, add the content of the footnote (it will be rendered at the end of the article by default).&lt;/p&gt;
&lt;p&gt;[^footnote]: Here is the content of the footnote&lt;/p&gt;
&lt;h3&gt;To-Do Lists&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;- [ ] Incomplete task
- [x] Completed task
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[ ] Incomplete task&lt;/li&gt;
&lt;li&gt;[x] Completed task&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Symbol Escaping&lt;/h3&gt;
&lt;p&gt;If you need to use markdown symbols like _ # * in your description but don&apos;t want them to be escaped, you can add a backslash before these symbols, such as &lt;code&gt;\_&lt;/code&gt; &lt;code&gt;\#&lt;/code&gt; &lt;code&gt;\*&lt;/code&gt; to avoid it.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;\_Don&apos;t want the text here to be italic\_

\*\*Don&apos;t want the text here to be bold\*\*
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;p&gt;_Don&apos;t want the text here to be italic_&lt;/p&gt;
&lt;p&gt;**Don&apos;t want the text here to be bold**&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;Embedding Astro Components&lt;/h2&gt;
&lt;p&gt;See &lt;a href=&quot;/docs/integrations/components&quot;&gt;User Components&lt;/a&gt; and &lt;a href=&quot;/docs/integrations/advanced&quot;&gt;Advanced Components&lt;/a&gt; for details.&lt;/p&gt;</content:encoded><h:img src="/_astro/thumbnail.HAXFr_hw.jpg"/><enclosure url="/_astro/thumbnail.HAXFr_hw.jpg"/></item><item><title>Markdown 语法支持</title><link>https://astro-pure.js.org/blog/markdown-zh</link><guid isPermaLink="true">https://astro-pure.js.org/blog/markdown-zh</guid><description>Markdown 是一种轻量级的「标记语言」。</description><pubDate>Wed, 26 Jul 2023 08:00:00 GMT</pubDate><content:encoded>&lt;h2&gt;基本语法&lt;/h2&gt;
&lt;p&gt;Markdown 是一种轻量级且易于使用的语法，用于为您的写作设计风格。&lt;/p&gt;
&lt;h3&gt;标题&lt;/h3&gt;
&lt;p&gt;文章内容较多时，可以用标题分段：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;# 标题 1

## 标题 2

## 大标题

### 小标题
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;标题预览会打乱文章的结构，所以在此不展示。&lt;/p&gt;
&lt;h3&gt;粗斜体&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;_斜体文本_

**粗体文本**

**_粗斜体文本_**
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;p&gt;&lt;em&gt;斜体文本&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;粗体文本&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;粗斜体文本&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;链接&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;文字链接 [链接名称](http://链接网址)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;p&gt;文字链接 &lt;a href=&quot;http://%E9%93%BE%E6%8E%A5%E7%BD%91%E5%9D%80&quot;&gt;链接名称&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;行内代码&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;这是一条 `单行代码`
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;p&gt;这是一条 &lt;code&gt;行内代码&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;代码块&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;```js
// calculate fibonacci
function fibonacci(n) {
  if (n &amp;#x3C;= 1) return 1
  return fibonacci(n - 1) + fibonacci(n - 2)
}
```
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;// calculate fibonacci
function fibonacci(n) {
  if (n &amp;#x3C;= 1) return 1
  return fibonacci(n - 1) + fibonacci(n - 2)
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;当前使用 shiki 作为代码高亮插件，支持的语言请参考 &lt;a href=&quot;https://shiki.matsu.io/languages.html&quot;&gt;shiki / languages&lt;/a&gt;。&lt;/p&gt;
&lt;h3&gt;行内公式&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;这是一条行内公式 $e^{i\pi} + 1 = 0$
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;p&gt;这是一条行内公式 $e^{i\pi} + 1 = 0$&lt;/p&gt;
&lt;h3&gt;公式块&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;$$
\hat{f}(\xi) = \int_{-\infty}^{\infty} f(x) e^{-2\pi i x \xi} \, dx
$$
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;p&gt;$$
\hat{f}(\xi) = \int_{-\infty}^{\infty} f(x) e^{-2\pi i x \xi} , dx
$$&lt;/p&gt;
&lt;p&gt;当前使用 KaTeX 作为数学公式插件，支持的语法请参考 &lt;a href=&quot;https://katex.org/docs/supported.html&quot;&gt;KaTeX Supported Functions&lt;/a&gt;。&lt;/p&gt;
&lt;h4&gt;图片&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;![CWorld](https://cravatar.cn/avatar/1ffe42aa45a6b1444a786b1f32dfa8aa?s=200)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cravatar.cn/avatar/1ffe42aa45a6b1444a786b1f32dfa8aa?s=200&quot; alt=&quot;CWorld&quot;&gt;&lt;/p&gt;
&lt;h4&gt;删除线&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;~~删除线~~
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;p&gt;~~删除线~~&lt;/p&gt;
&lt;h3&gt;列表&lt;/h3&gt;
&lt;p&gt;普通无序列表&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;- 1
- 2
- 3
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1&lt;/li&gt;
&lt;li&gt;2&lt;/li&gt;
&lt;li&gt;3&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;普通有序列表&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;1. GPT-4
2. Claude Opus
3. LLaMa
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;GPT-4&lt;/li&gt;
&lt;li&gt;Claude Opus&lt;/li&gt;
&lt;li&gt;LLaMa&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;列表里可以继续嵌套语法&lt;/p&gt;
&lt;h3&gt;引用&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;&gt; 枪响，雷鸣，剑起。繁花血景。
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;枪响，雷鸣，剑起。繁花血景。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;引用里也可以继续嵌套语法。&lt;/p&gt;
&lt;h3&gt;换行&lt;/h3&gt;
&lt;p&gt;markdown 分段落是需要空一行的。&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;如果不空行
就会在一段

第一段

第二段
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;p&gt;如果不空行
就会在一段&lt;/p&gt;
&lt;p&gt;第一段&lt;/p&gt;
&lt;p&gt;第二段&lt;/p&gt;
&lt;h3&gt;分隔符&lt;/h3&gt;
&lt;p&gt;如果你有写分割线的习惯，可以新起一行输入三个减号&lt;code&gt;---&lt;/code&gt; 或者星号 &lt;code&gt;***&lt;/code&gt;。当前后都有段落时，请空出一行：&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;---
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;高级技巧&lt;/h2&gt;
&lt;h3&gt;行内 HTML 元素&lt;/h3&gt;
&lt;p&gt;目前只支持部分段内 HTML 元素效果，包括 &lt;code&gt;&amp;#x3C;kdb&gt; &amp;#x3C;b&gt; &amp;#x3C;i&gt; &amp;#x3C;em&gt; &amp;#x3C;sup&gt; &amp;#x3C;sub&gt; &amp;#x3C;br&gt;&lt;/code&gt; ，如&lt;/p&gt;
&lt;h4&gt;键位显示&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;使用 &amp;#x3C;kbd&gt;Ctrl&amp;#x3C;/kbd&gt; + &amp;#x3C;kbd&gt;Alt&amp;#x3C;/kbd&gt; + &amp;#x3C;kbd&gt;Del&amp;#x3C;/kbd&gt; 重启电脑
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;p&gt;使用 Ctrl + Alt + Del 重启电脑&lt;/p&gt;
&lt;h4&gt;粗斜体&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;&amp;#x3C;b&gt; Markdown 在此处同样适用，如 _加粗_ &amp;#x3C;/b&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;p&gt; Markdown 在此处同样适用，如 &lt;em&gt;加粗&lt;/em&gt; &lt;/p&gt;
&lt;h3&gt;其他 HTML 写法&lt;/h3&gt;
&lt;h4&gt;折叠块&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;&amp;#x3C;details&gt;&amp;#x3C;summary&gt;点击展开&amp;#x3C;/summary&gt;它被隐藏了&amp;#x3C;/details&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;h3&gt;表格&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;| 表头1 | 表头2 |
| ----- | ----- |
| 内容1 | 内容2 |
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;p&gt;| 表头1 | 表头2 |
| ----- | ----- |
| 内容1 | 内容2 |&lt;/p&gt;
&lt;h3&gt;注释&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;在引用的地方使用 [^注释] 来添加注释。

然后在文档的结尾，添加注释的内容（会默认于文章结尾渲染之）。

[^注释]: 这里是注释的内容
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;p&gt;在引用的地方使用 &lt;a href=&quot;%E8%BF%99%E9%87%8C%E6%98%AF%E6%B3%A8%E9%87%8A%E7%9A%84%E5%86%85%E5%AE%B9&quot;&gt;^注释&lt;/a&gt; 来添加注释。&lt;/p&gt;
&lt;p&gt;然后在文档的结尾，添加注释的内容（会默认于文章结尾渲染之）。&lt;/p&gt;
&lt;h3&gt;To-Do 列表&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;- [ ] 未完成的任务
- [x] 已完成的任务
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[ ] 未完成的任务&lt;/li&gt;
&lt;li&gt;[x] 已完成的任务&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;符号转义&lt;/h3&gt;
&lt;p&gt;如果你的描述中需要用到 markdown 的符号，比如 _ # * 等，但又不想它被转义，这时候可以在这些符号前加反斜杠，如 &lt;code&gt;\_&lt;/code&gt; &lt;code&gt;\#&lt;/code&gt; &lt;code&gt;\*&lt;/code&gt; 进行避免。&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-markdown&quot;&gt;\_不想这里的文本变斜体\_

\*\*不想这里的文本被加粗\*\*
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;预览：&lt;/p&gt;
&lt;p&gt;_不想这里的文本变斜体_&lt;/p&gt;
&lt;p&gt;**不想这里的文本被加粗**&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;内嵌 Astro 组件&lt;/h2&gt;
&lt;p&gt;See &lt;a href=&quot;/docs/integrations/components&quot;&gt;User Components&lt;/a&gt; and &lt;a href=&quot;/docs/integrations/advanced&quot;&gt;Advanced Components&lt;/a&gt; for details.&lt;/p&gt;</content:encoded><h:img src="/_astro/thumbnail.HAXFr_hw.jpg"/><enclosure url="/_astro/thumbnail.HAXFr_hw.jpg"/></item></channel></rss>