[{"data":1,"prerenderedAt":1279},["ShallowReactive",2],{"meta:blog/2026-06-10-fix-rss-shiki-style":3,"content-query-O0qB9eQS7l":4},{},{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"date":11,"url":12,"tags":13,"en-title":18,"body":19,"_type":1273,"_id":1274,"_source":1275,"_file":1276,"_stem":1277,"_extension":1278},"/blog/2026-06-10-fix-rss-shiki-style","blog",false,"","修复 RSS Feed 中的 Shiki 样式污染问题","摘要：给博客加了 RSS 全文输出后，发现某些文章的 Feed 里混入了大量 CSS 代码。排查后发现是 Shiki 语法高亮的产物——本文记录问题原因和修复过程。","2026-06-10 20:00:00",null,[14,15,16,17],"博客","RSS","Nuxt","踩坑","Fixing Shiki Style Pollution in RSS Feed",{"type":20,"children":21,"toc":1265},"root",[22,30,35,39,45,50,72,386,391,396,401,620,625,630,651,686,691,718,1051,1071,1183,1188,1193,1218,1231,1236,1255,1260],{"type":23,"tag":24,"props":25,"children":27},"element","h1",{"id":26},"修复-rss-feed-中的-shiki-样式污染问题",[28],{"type":29,"value":9},"text",{"type":23,"tag":31,"props":32,"children":33},"p",{},[34],{"type":29,"value":10},{"type":23,"tag":36,"props":37,"children":38},"hr",{},[],{"type":23,"tag":40,"props":41,"children":43},"h2",{"id":42},"背景",[44],{"type":29,"value":42},{"type":23,"tag":31,"props":46,"children":47},{},[48],{"type":29,"value":49},"之前博客的 RSS 只输出标题和摘要，内容不够完整。我改成了直接输出文章全文 HTML，让 RSS 阅读器能直接展示完整的文章内容。",{"type":23,"tag":31,"props":51,"children":52},{},[53,55,62,64,70],{"type":29,"value":54},"实现思路是通过解析 Nuxt Content 的 AST（抽象语法树），将 ",{"type":23,"tag":56,"props":57,"children":59},"code",{"className":58},[],[60],{"type":29,"value":61},"body.children",{"type":29,"value":63}," 递归转换为简单的 HTML 标签，然后通过 CDATA 包裹输出到 RSS 的 ",{"type":23,"tag":56,"props":65,"children":67},{"className":66},[],[68],{"type":29,"value":69},"\u003Cdescription>",{"type":29,"value":71}," 字段。",{"type":23,"tag":73,"props":74,"children":78},"pre",{"className":75,"code":76,"language":77,"meta":8,"style":8},"language-ts shiki shiki-themes vitesse-light vitesse-dark monokai","// RSS 正文生成：遍历 AST 节点，映射为 HTML\nfunction bodyToHtml(node) {\n  switch (node.tag) {\n    case 'p':   return `\u003Cp>${children}\u003C/p>`\n    case 'h1':  return `\u003Ch1>${children}\u003C/h1>`\n    case 'code': return `\u003Ccode>${children}\u003C/code>`\n    // ... 更多标签映射\n  }\n}\n","ts",[79],{"type":23,"tag":56,"props":80,"children":81},{"__ignoreMap":8},[82,94,132,170,241,300,359,368,377],{"type":23,"tag":83,"props":84,"children":87},"span",{"class":85,"line":86},"line",1,[88],{"type":23,"tag":83,"props":89,"children":91},{"style":90},"--shiki-default:#A0ADA0;--shiki-dark:#758575DD;--shiki-sepia:#88846F",[92],{"type":29,"value":93},"// RSS 正文生成：遍历 AST 节点，映射为 HTML\n",{"type":23,"tag":83,"props":95,"children":97},{"class":85,"line":96},2,[98,104,110,116,122,127],{"type":23,"tag":83,"props":99,"children":101},{"style":100},"--shiki-default:#AB5959;--shiki-default-font-style:inherit;--shiki-dark:#CB7676;--shiki-dark-font-style:inherit;--shiki-sepia:#66D9EF;--shiki-sepia-font-style:italic",[102],{"type":29,"value":103},"function",{"type":23,"tag":83,"props":105,"children":107},{"style":106},"--shiki-default:#59873A;--shiki-dark:#80A665;--shiki-sepia:#A6E22E",[108],{"type":29,"value":109}," bodyToHtml",{"type":23,"tag":83,"props":111,"children":113},{"style":112},"--shiki-default:#999999;--shiki-dark:#666666;--shiki-sepia:#F8F8F2",[114],{"type":29,"value":115},"(",{"type":23,"tag":83,"props":117,"children":119},{"style":118},"--shiki-default:#B07D48;--shiki-default-font-style:inherit;--shiki-dark:#BD976A;--shiki-dark-font-style:inherit;--shiki-sepia:#FD971F;--shiki-sepia-font-style:italic",[120],{"type":29,"value":121},"node",{"type":23,"tag":83,"props":123,"children":124},{"style":112},[125],{"type":29,"value":126},")",{"type":23,"tag":83,"props":128,"children":129},{"style":112},[130],{"type":29,"value":131}," {\n",{"type":23,"tag":83,"props":133,"children":135},{"class":85,"line":134},3,[136,142,147,152,157,162,166],{"type":23,"tag":83,"props":137,"children":139},{"style":138},"--shiki-default:#1E754F;--shiki-dark:#4D9375;--shiki-sepia:#F92672",[140],{"type":29,"value":141},"  switch",{"type":23,"tag":83,"props":143,"children":144},{"style":112},[145],{"type":29,"value":146}," (",{"type":23,"tag":83,"props":148,"children":150},{"style":149},"--shiki-default:#B07D48;--shiki-dark:#BD976A;--shiki-sepia:#F8F8F2",[151],{"type":29,"value":121},{"type":23,"tag":83,"props":153,"children":154},{"style":112},[155],{"type":29,"value":156},".",{"type":23,"tag":83,"props":158,"children":159},{"style":149},[160],{"type":29,"value":161},"tag",{"type":23,"tag":83,"props":163,"children":164},{"style":112},[165],{"type":29,"value":126},{"type":23,"tag":83,"props":167,"children":168},{"style":112},[169],{"type":29,"value":131},{"type":23,"tag":83,"props":171,"children":173},{"class":85,"line":172},4,[174,179,185,190,195,200,205,210,215,220,226,231,236],{"type":23,"tag":83,"props":175,"children":176},{"style":138},[177],{"type":29,"value":178},"    case",{"type":23,"tag":83,"props":180,"children":182},{"style":181},"--shiki-default:#B5695977;--shiki-dark:#C98A7D77;--shiki-sepia:#E6DB74",[183],{"type":29,"value":184}," '",{"type":23,"tag":83,"props":186,"children":188},{"style":187},"--shiki-default:#B56959;--shiki-dark:#C98A7D;--shiki-sepia:#E6DB74",[189],{"type":29,"value":31},{"type":23,"tag":83,"props":191,"children":192},{"style":181},[193],{"type":29,"value":194},"'",{"type":23,"tag":83,"props":196,"children":197},{"style":112},[198],{"type":29,"value":199},":",{"type":23,"tag":83,"props":201,"children":202},{"style":138},[203],{"type":29,"value":204},"   return",{"type":23,"tag":83,"props":206,"children":207},{"style":181},[208],{"type":29,"value":209}," `",{"type":23,"tag":83,"props":211,"children":212},{"style":187},[213],{"type":29,"value":214},"\u003Cp>",{"type":23,"tag":83,"props":216,"children":217},{"style":138},[218],{"type":29,"value":219},"${",{"type":23,"tag":83,"props":221,"children":223},{"style":222},"--shiki-default:#B56959;--shiki-dark:#C98A7D;--shiki-sepia:#F8F8F2",[224],{"type":29,"value":225},"children",{"type":23,"tag":83,"props":227,"children":228},{"style":138},[229],{"type":29,"value":230},"}",{"type":23,"tag":83,"props":232,"children":233},{"style":187},[234],{"type":29,"value":235},"\u003C/p>",{"type":23,"tag":83,"props":237,"children":238},{"style":181},[239],{"type":29,"value":240},"`\n",{"type":23,"tag":83,"props":242,"children":244},{"class":85,"line":243},5,[245,249,253,257,261,265,270,274,279,283,287,291,296],{"type":23,"tag":83,"props":246,"children":247},{"style":138},[248],{"type":29,"value":178},{"type":23,"tag":83,"props":250,"children":251},{"style":181},[252],{"type":29,"value":184},{"type":23,"tag":83,"props":254,"children":255},{"style":187},[256],{"type":29,"value":24},{"type":23,"tag":83,"props":258,"children":259},{"style":181},[260],{"type":29,"value":194},{"type":23,"tag":83,"props":262,"children":263},{"style":112},[264],{"type":29,"value":199},{"type":23,"tag":83,"props":266,"children":267},{"style":138},[268],{"type":29,"value":269},"  return",{"type":23,"tag":83,"props":271,"children":272},{"style":181},[273],{"type":29,"value":209},{"type":23,"tag":83,"props":275,"children":276},{"style":187},[277],{"type":29,"value":278},"\u003Ch1>",{"type":23,"tag":83,"props":280,"children":281},{"style":138},[282],{"type":29,"value":219},{"type":23,"tag":83,"props":284,"children":285},{"style":222},[286],{"type":29,"value":225},{"type":23,"tag":83,"props":288,"children":289},{"style":138},[290],{"type":29,"value":230},{"type":23,"tag":83,"props":292,"children":293},{"style":187},[294],{"type":29,"value":295},"\u003C/h1>",{"type":23,"tag":83,"props":297,"children":298},{"style":181},[299],{"type":29,"value":240},{"type":23,"tag":83,"props":301,"children":303},{"class":85,"line":302},6,[304,308,312,316,320,324,329,333,338,342,346,350,355],{"type":23,"tag":83,"props":305,"children":306},{"style":138},[307],{"type":29,"value":178},{"type":23,"tag":83,"props":309,"children":310},{"style":181},[311],{"type":29,"value":184},{"type":23,"tag":83,"props":313,"children":314},{"style":187},[315],{"type":29,"value":56},{"type":23,"tag":83,"props":317,"children":318},{"style":181},[319],{"type":29,"value":194},{"type":23,"tag":83,"props":321,"children":322},{"style":112},[323],{"type":29,"value":199},{"type":23,"tag":83,"props":325,"children":326},{"style":138},[327],{"type":29,"value":328}," return",{"type":23,"tag":83,"props":330,"children":331},{"style":181},[332],{"type":29,"value":209},{"type":23,"tag":83,"props":334,"children":335},{"style":187},[336],{"type":29,"value":337},"\u003Ccode>",{"type":23,"tag":83,"props":339,"children":340},{"style":138},[341],{"type":29,"value":219},{"type":23,"tag":83,"props":343,"children":344},{"style":222},[345],{"type":29,"value":225},{"type":23,"tag":83,"props":347,"children":348},{"style":138},[349],{"type":29,"value":230},{"type":23,"tag":83,"props":351,"children":352},{"style":187},[353],{"type":29,"value":354},"\u003C/code>",{"type":23,"tag":83,"props":356,"children":357},{"style":181},[358],{"type":29,"value":240},{"type":23,"tag":83,"props":360,"children":362},{"class":85,"line":361},7,[363],{"type":23,"tag":83,"props":364,"children":365},{"style":90},[366],{"type":29,"value":367},"    // ... 更多标签映射\n",{"type":23,"tag":83,"props":369,"children":371},{"class":85,"line":370},8,[372],{"type":23,"tag":83,"props":373,"children":374},{"style":112},[375],{"type":29,"value":376},"  }\n",{"type":23,"tag":83,"props":378,"children":380},{"class":85,"line":379},9,[381],{"type":23,"tag":83,"props":382,"children":383},{"style":112},[384],{"type":29,"value":385},"}\n",{"type":23,"tag":31,"props":387,"children":388},{},[389],{"type":29,"value":390},"看起来没什么问题。",{"type":23,"tag":40,"props":392,"children":394},{"id":393},"问题现象",[395],{"type":29,"value":393},{"type":23,"tag":31,"props":397,"children":398},{},[399],{"type":29,"value":400},"上线后查看 RSS 源，发现某些文章底部跟了一大段奇怪的 CSS 代码：",{"type":23,"tag":73,"props":402,"children":406},{"className":403,"code":404,"language":405,"meta":8,"style":8},"language-css shiki shiki-themes vitesse-light vitesse-dark monokai","html .default .shiki span {\n  color: var(--shiki-default);\n  background: var(--shiki-default-bg);\n}\nhtml .dark .shiki span {\n  color: var(--shiki-dark);\n  background: var(--shiki-dark-bg);\n}\n/* ... 重复多组 */\n","css",[407],{"type":23,"tag":56,"props":408,"children":409},{"__ignoreMap":8},[410,448,481,510,517,549,577,605,612],{"type":23,"tag":83,"props":411,"children":412},{"class":85,"line":86},[413,418,424,430,434,439,444],{"type":23,"tag":83,"props":414,"children":415},{"style":138},[416],{"type":29,"value":417},"html",{"type":23,"tag":83,"props":419,"children":421},{"style":420},"--shiki-default:#999999;--shiki-dark:#666666;--shiki-sepia:#A6E22E",[422],{"type":29,"value":423}," .",{"type":23,"tag":83,"props":425,"children":427},{"style":426},"--shiki-default:#B07D48;--shiki-dark:#BD976A;--shiki-sepia:#A6E22E",[428],{"type":29,"value":429},"default",{"type":23,"tag":83,"props":431,"children":432},{"style":420},[433],{"type":29,"value":423},{"type":23,"tag":83,"props":435,"children":436},{"style":426},[437],{"type":29,"value":438},"shiki",{"type":23,"tag":83,"props":440,"children":441},{"style":138},[442],{"type":29,"value":443}," span",{"type":23,"tag":83,"props":445,"children":446},{"style":112},[447],{"type":29,"value":131},{"type":23,"tag":83,"props":449,"children":450},{"class":85,"line":96},[451,457,461,467,471,476],{"type":23,"tag":83,"props":452,"children":454},{"style":453},"--shiki-default:#998418;--shiki-default-font-style:inherit;--shiki-dark:#B8A965;--shiki-dark-font-style:inherit;--shiki-sepia:#66D9EF;--shiki-sepia-font-style:italic",[455],{"type":29,"value":456},"  color",{"type":23,"tag":83,"props":458,"children":459},{"style":112},[460],{"type":29,"value":199},{"type":23,"tag":83,"props":462,"children":464},{"style":463},"--shiki-default:#998418;--shiki-dark:#B8A965;--shiki-sepia:#66D9EF",[465],{"type":29,"value":466}," var",{"type":23,"tag":83,"props":468,"children":469},{"style":112},[470],{"type":29,"value":115},{"type":23,"tag":83,"props":472,"children":473},{"style":149},[474],{"type":29,"value":475},"--shiki-default",{"type":23,"tag":83,"props":477,"children":478},{"style":112},[479],{"type":29,"value":480},");\n",{"type":23,"tag":83,"props":482,"children":483},{"class":85,"line":134},[484,489,493,497,501,506],{"type":23,"tag":83,"props":485,"children":486},{"style":453},[487],{"type":29,"value":488},"  background",{"type":23,"tag":83,"props":490,"children":491},{"style":112},[492],{"type":29,"value":199},{"type":23,"tag":83,"props":494,"children":495},{"style":463},[496],{"type":29,"value":466},{"type":23,"tag":83,"props":498,"children":499},{"style":112},[500],{"type":29,"value":115},{"type":23,"tag":83,"props":502,"children":503},{"style":149},[504],{"type":29,"value":505},"--shiki-default-bg",{"type":23,"tag":83,"props":507,"children":508},{"style":112},[509],{"type":29,"value":480},{"type":23,"tag":83,"props":511,"children":512},{"class":85,"line":172},[513],{"type":23,"tag":83,"props":514,"children":515},{"style":112},[516],{"type":29,"value":385},{"type":23,"tag":83,"props":518,"children":519},{"class":85,"line":243},[520,524,528,533,537,541,545],{"type":23,"tag":83,"props":521,"children":522},{"style":138},[523],{"type":29,"value":417},{"type":23,"tag":83,"props":525,"children":526},{"style":420},[527],{"type":29,"value":423},{"type":23,"tag":83,"props":529,"children":530},{"style":426},[531],{"type":29,"value":532},"dark",{"type":23,"tag":83,"props":534,"children":535},{"style":420},[536],{"type":29,"value":423},{"type":23,"tag":83,"props":538,"children":539},{"style":426},[540],{"type":29,"value":438},{"type":23,"tag":83,"props":542,"children":543},{"style":138},[544],{"type":29,"value":443},{"type":23,"tag":83,"props":546,"children":547},{"style":112},[548],{"type":29,"value":131},{"type":23,"tag":83,"props":550,"children":551},{"class":85,"line":302},[552,556,560,564,568,573],{"type":23,"tag":83,"props":553,"children":554},{"style":453},[555],{"type":29,"value":456},{"type":23,"tag":83,"props":557,"children":558},{"style":112},[559],{"type":29,"value":199},{"type":23,"tag":83,"props":561,"children":562},{"style":463},[563],{"type":29,"value":466},{"type":23,"tag":83,"props":565,"children":566},{"style":112},[567],{"type":29,"value":115},{"type":23,"tag":83,"props":569,"children":570},{"style":149},[571],{"type":29,"value":572},"--shiki-dark",{"type":23,"tag":83,"props":574,"children":575},{"style":112},[576],{"type":29,"value":480},{"type":23,"tag":83,"props":578,"children":579},{"class":85,"line":361},[580,584,588,592,596,601],{"type":23,"tag":83,"props":581,"children":582},{"style":453},[583],{"type":29,"value":488},{"type":23,"tag":83,"props":585,"children":586},{"style":112},[587],{"type":29,"value":199},{"type":23,"tag":83,"props":589,"children":590},{"style":463},[591],{"type":29,"value":466},{"type":23,"tag":83,"props":593,"children":594},{"style":112},[595],{"type":29,"value":115},{"type":23,"tag":83,"props":597,"children":598},{"style":149},[599],{"type":29,"value":600},"--shiki-dark-bg",{"type":23,"tag":83,"props":602,"children":603},{"style":112},[604],{"type":29,"value":480},{"type":23,"tag":83,"props":606,"children":607},{"class":85,"line":370},[608],{"type":23,"tag":83,"props":609,"children":610},{"style":112},[611],{"type":29,"value":385},{"type":23,"tag":83,"props":613,"children":614},{"class":85,"line":379},[615],{"type":23,"tag":83,"props":616,"children":617},{"style":90},[618],{"type":29,"value":619},"/* ... 重复多组 */\n",{"type":23,"tag":31,"props":621,"children":622},{},[623],{"type":29,"value":624},"显然，这是语法高亮引擎 Shiki 的 CSS 样式定义，不应该出现在 RSS 里。",{"type":23,"tag":40,"props":626,"children":628},{"id":627},"排查",[629],{"type":29,"value":627},{"type":23,"tag":31,"props":631,"children":632},{},[633,635,641,643,649],{"type":29,"value":634},"Nuxt Content 默认使用 Shiki 做代码块语法高亮。在构建时，Shiki 会对 markdown 中的代码块进行处理，给每个 ",{"type":23,"tag":56,"props":636,"children":638},{"className":637},[],[639],{"type":29,"value":640},"\u003Cspan>",{"type":29,"value":642}," 加上行内颜色样式，同时在文档中插入 ",{"type":23,"tag":56,"props":644,"children":646},{"className":645},[],[647],{"type":29,"value":648},"\u003Cstyle>",{"type":29,"value":650}," 标签来定义高亮主题的 CSS 变量。",{"type":23,"tag":31,"props":652,"children":653},{},[654,656,662,664,670,672,677,679,684],{"type":29,"value":655},"问题在于，我的 ",{"type":23,"tag":56,"props":657,"children":659},{"className":658},[],[660],{"type":29,"value":661},"bodyToHtml",{"type":29,"value":663}," 函数是一个通用的 AST 遍历器——",{"type":23,"tag":665,"props":666,"children":667},"strong",{},[668],{"type":29,"value":669},"它不区分内容节点和样式节点",{"type":29,"value":671},"。当遍历到 ",{"type":23,"tag":56,"props":673,"children":675},{"className":674},[],[676],{"type":29,"value":648},{"type":29,"value":678}," 标签时，",{"type":23,"tag":56,"props":680,"children":682},{"className":681},[],[683],{"type":29,"value":429},{"type":29,"value":685}," 分支直接返回了它的子节点（即 CSS 文本内容），这些内容就被当作正文输出了。",{"type":23,"tag":40,"props":687,"children":689},{"id":688},"修复",[690],{"type":29,"value":688},{"type":23,"tag":31,"props":692,"children":693},{},[694,696,701,703,708,710,716],{"type":29,"value":695},"修复很简单：在递归遍历时跳过 ",{"type":23,"tag":56,"props":697,"children":699},{"className":698},[],[700],{"type":29,"value":648},{"type":29,"value":702}," 和 ",{"type":23,"tag":56,"props":704,"children":706},{"className":705},[],[707],{"type":29,"value":640},{"type":29,"value":709}," 标签，同时对代码块 ( ",{"type":23,"tag":56,"props":711,"children":713},{"className":712},[],[714],{"type":29,"value":715},"\u003Cpre>",{"type":29,"value":717}," ) 直接提取纯文本，不做样式渲染。",{"type":23,"tag":73,"props":719,"children":721},{"className":75,"code":720,"language":77,"meta":8,"style":8},"function bodyToHtml(node) {\n  // ... 基础节点处理 ...\n\n  // 跳过 Shiki 注入的样式标签\n  if (node.tag === 'style' || node.tag === 'span') return ''\n\n  // 代码块直接提取纯文本，不要 Shiki 的高亮结构\n  if (node.tag === 'pre') {\n    const text = extractPlainText(node)\n    return `\u003Cpre>\u003Ccode>${escapeXml(text)}\u003C/code>\u003C/pre>`\n  }\n\n  // ... 其他标签映射 ...\n}\n",[722],{"type":23,"tag":56,"props":723,"children":724},{"__ignoreMap":8},[725,752,760,769,777,867,874,882,929,966,1018,1026,1034,1043],{"type":23,"tag":83,"props":726,"children":727},{"class":85,"line":86},[728,732,736,740,744,748],{"type":23,"tag":83,"props":729,"children":730},{"style":100},[731],{"type":29,"value":103},{"type":23,"tag":83,"props":733,"children":734},{"style":106},[735],{"type":29,"value":109},{"type":23,"tag":83,"props":737,"children":738},{"style":112},[739],{"type":29,"value":115},{"type":23,"tag":83,"props":741,"children":742},{"style":118},[743],{"type":29,"value":121},{"type":23,"tag":83,"props":745,"children":746},{"style":112},[747],{"type":29,"value":126},{"type":23,"tag":83,"props":749,"children":750},{"style":112},[751],{"type":29,"value":131},{"type":23,"tag":83,"props":753,"children":754},{"class":85,"line":96},[755],{"type":23,"tag":83,"props":756,"children":757},{"style":90},[758],{"type":29,"value":759},"  // ... 基础节点处理 ...\n",{"type":23,"tag":83,"props":761,"children":762},{"class":85,"line":134},[763],{"type":23,"tag":83,"props":764,"children":766},{"emptyLinePlaceholder":765},true,[767],{"type":29,"value":768},"\n",{"type":23,"tag":83,"props":770,"children":771},{"class":85,"line":172},[772],{"type":23,"tag":83,"props":773,"children":774},{"style":90},[775],{"type":29,"value":776},"  // 跳过 Shiki 注入的样式标签\n",{"type":23,"tag":83,"props":778,"children":779},{"class":85,"line":243},[780,785,789,793,797,801,807,811,816,820,825,830,834,838,842,846,850,854,858,862],{"type":23,"tag":83,"props":781,"children":782},{"style":138},[783],{"type":29,"value":784},"  if",{"type":23,"tag":83,"props":786,"children":787},{"style":112},[788],{"type":29,"value":146},{"type":23,"tag":83,"props":790,"children":791},{"style":149},[792],{"type":29,"value":121},{"type":23,"tag":83,"props":794,"children":795},{"style":112},[796],{"type":29,"value":156},{"type":23,"tag":83,"props":798,"children":799},{"style":149},[800],{"type":29,"value":161},{"type":23,"tag":83,"props":802,"children":804},{"style":803},"--shiki-default:#AB5959;--shiki-dark:#CB7676;--shiki-sepia:#F92672",[805],{"type":29,"value":806}," ===",{"type":23,"tag":83,"props":808,"children":809},{"style":181},[810],{"type":29,"value":184},{"type":23,"tag":83,"props":812,"children":813},{"style":187},[814],{"type":29,"value":815},"style",{"type":23,"tag":83,"props":817,"children":818},{"style":181},[819],{"type":29,"value":194},{"type":23,"tag":83,"props":821,"children":822},{"style":803},[823],{"type":29,"value":824}," ||",{"type":23,"tag":83,"props":826,"children":827},{"style":149},[828],{"type":29,"value":829}," node",{"type":23,"tag":83,"props":831,"children":832},{"style":112},[833],{"type":29,"value":156},{"type":23,"tag":83,"props":835,"children":836},{"style":149},[837],{"type":29,"value":161},{"type":23,"tag":83,"props":839,"children":840},{"style":803},[841],{"type":29,"value":806},{"type":23,"tag":83,"props":843,"children":844},{"style":181},[845],{"type":29,"value":184},{"type":23,"tag":83,"props":847,"children":848},{"style":187},[849],{"type":29,"value":83},{"type":23,"tag":83,"props":851,"children":852},{"style":181},[853],{"type":29,"value":194},{"type":23,"tag":83,"props":855,"children":856},{"style":112},[857],{"type":29,"value":126},{"type":23,"tag":83,"props":859,"children":860},{"style":138},[861],{"type":29,"value":328},{"type":23,"tag":83,"props":863,"children":864},{"style":181},[865],{"type":29,"value":866}," ''\n",{"type":23,"tag":83,"props":868,"children":869},{"class":85,"line":302},[870],{"type":23,"tag":83,"props":871,"children":872},{"emptyLinePlaceholder":765},[873],{"type":29,"value":768},{"type":23,"tag":83,"props":875,"children":876},{"class":85,"line":361},[877],{"type":23,"tag":83,"props":878,"children":879},{"style":90},[880],{"type":29,"value":881},"  // 代码块直接提取纯文本，不要 Shiki 的高亮结构\n",{"type":23,"tag":83,"props":883,"children":884},{"class":85,"line":370},[885,889,893,897,901,905,909,913,917,921,925],{"type":23,"tag":83,"props":886,"children":887},{"style":138},[888],{"type":29,"value":784},{"type":23,"tag":83,"props":890,"children":891},{"style":112},[892],{"type":29,"value":146},{"type":23,"tag":83,"props":894,"children":895},{"style":149},[896],{"type":29,"value":121},{"type":23,"tag":83,"props":898,"children":899},{"style":112},[900],{"type":29,"value":156},{"type":23,"tag":83,"props":902,"children":903},{"style":149},[904],{"type":29,"value":161},{"type":23,"tag":83,"props":906,"children":907},{"style":803},[908],{"type":29,"value":806},{"type":23,"tag":83,"props":910,"children":911},{"style":181},[912],{"type":29,"value":184},{"type":23,"tag":83,"props":914,"children":915},{"style":187},[916],{"type":29,"value":73},{"type":23,"tag":83,"props":918,"children":919},{"style":181},[920],{"type":29,"value":194},{"type":23,"tag":83,"props":922,"children":923},{"style":112},[924],{"type":29,"value":126},{"type":23,"tag":83,"props":926,"children":927},{"style":112},[928],{"type":29,"value":131},{"type":23,"tag":83,"props":930,"children":931},{"class":85,"line":379},[932,937,942,948,953,957,961],{"type":23,"tag":83,"props":933,"children":934},{"style":100},[935],{"type":29,"value":936},"    const",{"type":23,"tag":83,"props":938,"children":939},{"style":149},[940],{"type":29,"value":941}," text",{"type":23,"tag":83,"props":943,"children":945},{"style":944},"--shiki-default:#999999;--shiki-dark:#666666;--shiki-sepia:#F92672",[946],{"type":29,"value":947}," =",{"type":23,"tag":83,"props":949,"children":950},{"style":106},[951],{"type":29,"value":952}," extractPlainText",{"type":23,"tag":83,"props":954,"children":955},{"style":112},[956],{"type":29,"value":115},{"type":23,"tag":83,"props":958,"children":959},{"style":149},[960],{"type":29,"value":121},{"type":23,"tag":83,"props":962,"children":963},{"style":112},[964],{"type":29,"value":965},")\n",{"type":23,"tag":83,"props":967,"children":969},{"class":85,"line":968},10,[970,975,979,984,988,993,997,1001,1005,1009,1014],{"type":23,"tag":83,"props":971,"children":972},{"style":138},[973],{"type":29,"value":974},"    return",{"type":23,"tag":83,"props":976,"children":977},{"style":181},[978],{"type":29,"value":209},{"type":23,"tag":83,"props":980,"children":981},{"style":187},[982],{"type":29,"value":983},"\u003Cpre>\u003Ccode>",{"type":23,"tag":83,"props":985,"children":986},{"style":138},[987],{"type":29,"value":219},{"type":23,"tag":83,"props":989,"children":990},{"style":106},[991],{"type":29,"value":992},"escapeXml",{"type":23,"tag":83,"props":994,"children":995},{"style":112},[996],{"type":29,"value":115},{"type":23,"tag":83,"props":998,"children":999},{"style":222},[1000],{"type":29,"value":29},{"type":23,"tag":83,"props":1002,"children":1003},{"style":112},[1004],{"type":29,"value":126},{"type":23,"tag":83,"props":1006,"children":1007},{"style":138},[1008],{"type":29,"value":230},{"type":23,"tag":83,"props":1010,"children":1011},{"style":187},[1012],{"type":29,"value":1013},"\u003C/code>\u003C/pre>",{"type":23,"tag":83,"props":1015,"children":1016},{"style":181},[1017],{"type":29,"value":240},{"type":23,"tag":83,"props":1019,"children":1021},{"class":85,"line":1020},11,[1022],{"type":23,"tag":83,"props":1023,"children":1024},{"style":112},[1025],{"type":29,"value":376},{"type":23,"tag":83,"props":1027,"children":1029},{"class":85,"line":1028},12,[1030],{"type":23,"tag":83,"props":1031,"children":1032},{"emptyLinePlaceholder":765},[1033],{"type":29,"value":768},{"type":23,"tag":83,"props":1035,"children":1037},{"class":85,"line":1036},13,[1038],{"type":23,"tag":83,"props":1039,"children":1040},{"style":90},[1041],{"type":29,"value":1042},"  // ... 其他标签映射 ...\n",{"type":23,"tag":83,"props":1044,"children":1046},{"class":85,"line":1045},14,[1047],{"type":23,"tag":83,"props":1048,"children":1049},{"style":112},[1050],{"type":29,"value":385},{"type":23,"tag":31,"props":1052,"children":1053},{},[1054,1056,1061,1063,1069],{"type":29,"value":1055},"同时还有一个隐藏的问题：之前的 RSS description 对整个 HTML 做了 ",{"type":23,"tag":56,"props":1057,"children":1059},{"className":1058},[],[1060],{"type":29,"value":992},{"type":29,"value":1062}," 转义，导致所有标签都变成了 ",{"type":23,"tag":56,"props":1064,"children":1066},{"className":1065},[],[1067],{"type":29,"value":1068},"&lt;p&gt;",{"type":29,"value":1070}," 这样的实体。正确的做法是用 CDATA 包裹 HTML 内容：",{"type":23,"tag":73,"props":1072,"children":1074},{"className":75,"code":1073,"language":77,"meta":8,"style":8},"const description = contentHtml\n  ? `\u003C![CDATA[${contentHtml}]]>`\n  : escapeXml(doc.description || title)\n",[1075],{"type":23,"tag":56,"props":1076,"children":1077},{"__ignoreMap":8},[1078,1100,1139],{"type":23,"tag":83,"props":1079,"children":1080},{"class":85,"line":86},[1081,1086,1091,1095],{"type":23,"tag":83,"props":1082,"children":1083},{"style":100},[1084],{"type":29,"value":1085},"const",{"type":23,"tag":83,"props":1087,"children":1088},{"style":149},[1089],{"type":29,"value":1090}," description",{"type":23,"tag":83,"props":1092,"children":1093},{"style":944},[1094],{"type":29,"value":947},{"type":23,"tag":83,"props":1096,"children":1097},{"style":149},[1098],{"type":29,"value":1099}," contentHtml\n",{"type":23,"tag":83,"props":1101,"children":1102},{"class":85,"line":96},[1103,1108,1112,1117,1121,1126,1130,1135],{"type":23,"tag":83,"props":1104,"children":1105},{"style":803},[1106],{"type":29,"value":1107},"  ?",{"type":23,"tag":83,"props":1109,"children":1110},{"style":181},[1111],{"type":29,"value":209},{"type":23,"tag":83,"props":1113,"children":1114},{"style":187},[1115],{"type":29,"value":1116},"\u003C![CDATA[",{"type":23,"tag":83,"props":1118,"children":1119},{"style":138},[1120],{"type":29,"value":219},{"type":23,"tag":83,"props":1122,"children":1123},{"style":222},[1124],{"type":29,"value":1125},"contentHtml",{"type":23,"tag":83,"props":1127,"children":1128},{"style":138},[1129],{"type":29,"value":230},{"type":23,"tag":83,"props":1131,"children":1132},{"style":187},[1133],{"type":29,"value":1134},"]]>",{"type":23,"tag":83,"props":1136,"children":1137},{"style":181},[1138],{"type":29,"value":240},{"type":23,"tag":83,"props":1140,"children":1141},{"class":85,"line":134},[1142,1147,1152,1156,1161,1165,1170,1174,1179],{"type":23,"tag":83,"props":1143,"children":1144},{"style":803},[1145],{"type":29,"value":1146},"  :",{"type":23,"tag":83,"props":1148,"children":1149},{"style":106},[1150],{"type":29,"value":1151}," escapeXml",{"type":23,"tag":83,"props":1153,"children":1154},{"style":112},[1155],{"type":29,"value":115},{"type":23,"tag":83,"props":1157,"children":1158},{"style":149},[1159],{"type":29,"value":1160},"doc",{"type":23,"tag":83,"props":1162,"children":1163},{"style":112},[1164],{"type":29,"value":156},{"type":23,"tag":83,"props":1166,"children":1167},{"style":149},[1168],{"type":29,"value":1169},"description",{"type":23,"tag":83,"props":1171,"children":1172},{"style":803},[1173],{"type":29,"value":824},{"type":23,"tag":83,"props":1175,"children":1176},{"style":149},[1177],{"type":29,"value":1178}," title",{"type":23,"tag":83,"props":1180,"children":1181},{"style":112},[1182],{"type":29,"value":965},{"type":23,"tag":40,"props":1184,"children":1186},{"id":1185},"最终效果",[1187],{"type":29,"value":1185},{"type":23,"tag":31,"props":1189,"children":1190},{},[1191],{"type":29,"value":1192},"修复后的 RSS Feed：",{"type":23,"tag":1194,"props":1195,"children":1196},"ul",{},[1197,1203,1208,1213],{"type":23,"tag":1198,"props":1199,"children":1200},"li",{},[1201],{"type":29,"value":1202},"文章正文干净输出，没有 Shiki CSS 污染",{"type":23,"tag":1198,"props":1204,"children":1205},{},[1206],{"type":29,"value":1207},"代码块显示为纯文本，阅读器友好",{"type":23,"tag":1198,"props":1209,"children":1210},{},[1211],{"type":29,"value":1212},"所有分类文章（blog、life、record）均包含",{"type":23,"tag":1198,"props":1214,"children":1215},{},[1216],{"type":29,"value":1217},"全文 CDATA 包裹，RSS 阅读器正常解析",{"type":23,"tag":31,"props":1219,"children":1220},{},[1221,1223],{"type":29,"value":1222},"查看 RSS：",{"type":23,"tag":1224,"props":1225,"children":1229},"a",{"href":1226,"rel":1227},"https://www.hutiger.men/rss.xml",[1228],"nofollow",[1230],{"type":29,"value":1226},{"type":23,"tag":40,"props":1232,"children":1234},{"id":1233},"小结",[1235],{"type":29,"value":1233},{"type":23,"tag":31,"props":1237,"children":1238},{},[1239,1241,1246,1248,1253],{"type":29,"value":1240},"这次踩坑的本质是",{"type":23,"tag":665,"props":1242,"children":1243},{},[1244],{"type":29,"value":1245},"对框架内部机制不够了解",{"type":29,"value":1247},"——Shiki 对代码块的加工是 Nuxt Content 的默认行为，但在自己实现 AST 遍历时，忘记考虑它会在文档中插入额外的 ",{"type":23,"tag":56,"props":1249,"children":1251},{"className":1250},[],[1252],{"type":29,"value":648},{"type":29,"value":1254}," 节点。",{"type":23,"tag":31,"props":1256,"children":1257},{},[1258],{"type":29,"value":1259},"对于静态站点生成来说，留意\"构建时运行的代码\"会往数据里注入什么，是减少这类问题的关键。",{"type":23,"tag":815,"props":1261,"children":1262},{},[1263],{"type":29,"value":1264},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html .sepia .shiki span {color: var(--shiki-sepia);background: var(--shiki-sepia-bg);font-style: var(--shiki-sepia-font-style);font-weight: var(--shiki-sepia-font-weight);text-decoration: var(--shiki-sepia-text-decoration);}html.sepia .shiki span {color: var(--shiki-sepia);background: var(--shiki-sepia-bg);font-style: var(--shiki-sepia-font-style);font-weight: var(--shiki-sepia-font-weight);text-decoration: var(--shiki-sepia-text-decoration);}",{"title":8,"searchDepth":96,"depth":96,"links":1266},[1267,1268,1269,1270,1271,1272],{"id":42,"depth":96,"text":42},{"id":393,"depth":96,"text":393},{"id":627,"depth":96,"text":627},{"id":688,"depth":96,"text":688},{"id":1185,"depth":96,"text":1185},{"id":1233,"depth":96,"text":1233},"markdown","content:blog:2026-06-10-fix-rss-shiki-style.md","content","blog/2026-06-10-fix-rss-shiki-style.md","blog/2026-06-10-fix-rss-shiki-style","md",1781150698274]