@cloud411716/fancy-webnovel 4.26.0 → 4.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud411716/fancy-webnovel",
3
- "version": "4.26.0",
3
+ "version": "4.26.1",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -363,10 +363,17 @@ function renderQidianMarkdown(rankLabel, url, books) {
363
363
  lines.push(`- **打赏:** 今日 ${t} / 本周 ${w}`);
364
364
  }
365
365
  if (b.intro) {
366
- // 格式与其它字段保持一致:首段紧跟标签,其余段落各自成段。
367
- // 起点简介里的换行有两种语义(<br> → 行分隔、段落标签 → 段分隔),
368
- // 所以按空行分段,不按单换行。
369
- lines.push(...renderIntroLines(b.intro));
366
+ // 格式与其它字段保持一致:首段紧跟标签,其余行各自缩进。
367
+ //
368
+ // 起点桌面页的 #book-intro-detail 会把作者原文里的 \n\n 段落压成
369
+ // 单个 <br>。例如《凡人:聚宝盆里出灵石》的移动端 desc 每句之间都是
370
+ // \n\n,但 https://www.qidian.com/book/1051335496/ 页面上只换行、不空行。
371
+ // 扫描结果以页面展示为准,先把段间空行压成单换行,再交给公共渲染函数,
372
+ // 这样简介只会出现段内硬换行,不会多出空行。
373
+ const intro = (Array.isArray(b.intro) ? b.intro.join('\n') : String(b.intro))
374
+ .replace(/\r\n?/g, '\n')
375
+ .replace(/\n(?:[ \t ]*\n)+/g, '\n');
376
+ lines.push(...renderIntroLines(intro));
370
377
  }
371
378
  if (b.url) lines.push(`- [作品页](${b.url})`);
372
379
  lines.push('', '---', '');