argo-search 2.15.0 → 2.17.0
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/AGENTS.md +3 -1
- package/README.es.md +32 -5
- package/README.ja.md +32 -5
- package/README.ko.md +32 -5
- package/README.md +73 -19
- package/README.zh.md +73 -19
- package/SKILL.md +7 -7
- package/assets/readme/counts.json +1 -1
- package/assets/readme/hero.svg +3 -3
- package/assets/readme/hero.template.svg +121 -0
- package/assets/readme/proof-routes.svg +17 -16
- package/backends/domain_profiles.json +222 -24
- package/backends/engine_registry.yaml +26 -2
- package/backends/env_passthrough.txt +2 -0
- package/backends/quota_profiles.json +23 -3
- package/bin/argo +3 -0
- package/config.yaml +16 -0
- package/docs/CHANGELOG.md +31 -0
- package/docs/COMMIT_STANDARD.md +10 -0
- package/docs/ENGINE_CATALOG.md +40 -37
- package/docs/MCP_SETUP.md +9 -0
- package/docs/RELEASE_NOTES_v2.16.0.md +58 -0
- package/docs/RELEASE_NOTES_v2.17.0.md +64 -0
- package/docs/RELEASING.md +1 -1
- package/engines/specs/archive_org.yaml +1 -1
- package/engines/specs/carbon_intensity.yaml +1 -1
- package/engines/specs/crates.yaml +1 -1
- package/engines/specs/crossref.yaml +6 -2
- package/engines/specs/crt_sh.yaml +1 -1
- package/engines/specs/dblp.yaml +1 -1
- package/engines/specs/devto.yaml +1 -1
- package/engines/specs/docker_hub.yaml +1 -1
- package/engines/specs/europepmc.yaml +1 -1
- package/engines/specs/fxtwitter.yaml +1 -1
- package/engines/specs/gbfs_nyc.yaml +1 -1
- package/engines/specs/gleif.yaml +1 -1
- package/engines/specs/gov_regulations.yaml +1 -1
- package/engines/specs/hackernews.yaml +2 -0
- package/engines/specs/helve.yaml +49 -0
- package/engines/specs/hf_datasets.yaml +1 -1
- package/engines/specs/hf_papers.yaml +2 -0
- package/engines/specs/huggingface.yaml +1 -1
- package/engines/specs/keenable.yaml +7 -1
- package/engines/specs/linux_do.yaml +63 -0
- package/engines/specs/local_crossref.yaml +3 -1
- package/engines/specs/local_github.yaml +1 -1
- package/engines/specs/local_npm.yaml +6 -0
- package/engines/specs/local_openstreetmap.yaml +1 -1
- package/engines/specs/maven.yaml +1 -1
- package/engines/specs/mdn.yaml +1 -1
- package/engines/specs/musicbrainz.yaml +1 -1
- package/engines/specs/nasa_images.yaml +1 -1
- package/engines/specs/nhtsa_vpic.yaml +6 -3
- package/engines/specs/npm.yaml +1 -1
- package/engines/specs/nuget.yaml +1 -1
- package/engines/specs/nvd.yaml +1 -1
- package/engines/specs/openalex.yaml +13 -4
- package/engines/specs/openreview.yaml +1 -1
- package/engines/specs/polymarket.yaml +1 -1
- package/engines/specs/sec_edgar.yaml +1 -1
- package/engines/specs/steam.yaml +1 -1
- package/engines/specs/vam.yaml +1 -1
- package/engines/specs/wikidata.yaml +1 -1
- package/engines/specs/wikipedia.yaml +1 -1
- package/engines/specs/zhihu_hot_app.yaml +1 -1
- package/package.json +3 -1
- package/packages/dsh-plugin/README.md +5 -2
- package/packages/dsh-plugin/cordis.patch.yml +4 -1
- package/packages/dsh-plugin/dsh/client.js +69 -74
- package/packages/dsh-plugin/dsh/diagnostics.js +25 -4
- package/packages/dsh-plugin/dsh/index.js +115 -21
- package/packages/dsh-plugin/dsh/route-guard.js +95 -0
- package/packages/dsh-plugin/dsh/runner.js +50 -7
- package/packages/dsh-plugin/dsh/wide-research.js +20 -18
- package/packages/dsh-plugin/dsh/workbench-client.js +895 -0
- package/packages/dsh-plugin/dsh/workbench-io.js +163 -0
- package/packages/dsh-plugin/dsh/workbench-md.js +386 -0
- package/packages/dsh-plugin/dsh/workbench-search.js +385 -0
- package/packages/dsh-plugin/dsh/workbench-suggestions.js +460 -0
- package/packages/dsh-plugin/dsh/workbench.js +703 -0
- package/packages/dsh-plugin/icon.svg +23 -0
- package/packages/dsh-plugin/package.json +6 -3
- package/packages/dsh-plugin/scripts/sync-local.mjs +4 -2
- package/packages/dsh-plugin/scripts/sync-local.sh +4 -2
- package/packages/dsh-plugin/test/client.test.js +26 -0
- package/packages/dsh-plugin/test/diagnostics.test.js +5 -2
- package/packages/dsh-plugin/test/index.test.js +150 -1
- package/packages/dsh-plugin/test/workbench-concurrency.test.js +98 -0
- package/packages/dsh-plugin/test/workbench.test.js +420 -0
- package/scripts/adaptive.py +13 -11
- package/scripts/argo_paths.py +2 -2
- package/scripts/badcase_ledger.py +9 -0
- package/scripts/browser_auth.py +178 -4
- package/scripts/cache.py +69 -70
- package/scripts/check_commit_report.py +46 -0
- package/scripts/chrome_cdp.py +71 -0
- package/scripts/circuit_breaker.py +91 -13
- package/scripts/config_cache.py +23 -10
- package/scripts/daemon.py +14 -2
- package/scripts/engine_add.py +45 -0
- package/scripts/engine_dispatch.py +32 -49
- package/scripts/engine_env.py +13 -4
- package/scripts/engine_failure.py +33 -0
- package/scripts/engine_fingerprint.py +114 -0
- package/scripts/engine_health.py +130 -0
- package/scripts/engine_states.py +50 -0
- package/scripts/engines_base.py +31 -19
- package/scripts/engines_builders_archive.py +4 -3
- package/scripts/engines_builders_batch11.py +2 -1
- package/scripts/engines_builders_batch13.py +4 -3
- package/scripts/engines_builders_batch14.py +2 -1
- package/scripts/engines_builders_batch15.py +2 -1
- package/scripts/engines_builders_batch9.py +2 -2
- package/scripts/engines_builders_cn.py +7 -7
- package/scripts/engines_builders_data.py +12 -11
- package/scripts/engines_builders_data_macro.py +5 -4
- package/scripts/engines_builders_dsh.py +2 -1
- package/scripts/engines_builders_feeds.py +34 -19
- package/scripts/engines_builders_finance.py +2 -1
- package/scripts/engines_builders_intl.py +3 -2
- package/scripts/engines_builders_media.py +59 -12
- package/scripts/engines_builders_science.py +8 -7
- package/scripts/engines_builders_search.py +19 -8
- package/scripts/engines_builders_skill.py +2 -1
- package/scripts/engines_builders_tech.py +19 -19
- package/scripts/engines_builders_weather.py +9 -4
- package/scripts/engines_fields.py +23 -0
- package/scripts/engines_http.py +50 -1
- package/scripts/engines_mcp.py +28 -6
- package/scripts/evidence_grounding.py +182 -0
- package/scripts/evidence_loop.py +15 -1
- package/scripts/extend_route_labels.py +6 -0
- package/scripts/fetch_browser.py +25 -10
- package/scripts/fetch_jina.py +98 -0
- package/scripts/fetch_v3.py +52 -93
- package/scripts/gate_manifest_check.py +75 -0
- package/scripts/gen_readme_art.py +264 -0
- package/scripts/image_vision/vision_probe +0 -0
- package/scripts/install.sh +2 -0
- package/scripts/matrix_search_eval.py +8 -10
- package/scripts/mcp_transport.py +33 -9
- package/scripts/numeric_verify.py +12 -2
- package/scripts/output_transparency.py +3 -0
- package/scripts/pre-commit +57 -8
- package/scripts/query_operators.py +229 -1
- package/scripts/quota.py +46 -63
- package/scripts/recovery.py +19 -16
- package/scripts/recovery_runner.py +29 -10
- package/scripts/redskill/redskill_engine.py +2 -1
- package/scripts/release.py +16 -1
- package/scripts/research_gates.py +85 -1
- package/scripts/route.py +8 -0
- package/scripts/route_combo.py +24 -3
- package/scripts/route_policy.py +1 -1
- package/scripts/search_attribution.py +20 -0
- package/scripts/search_entry.py +27 -0
- package/scripts/search_output.py +18 -7
- package/scripts/search_pipeline.py +3 -3
- package/scripts/semantic_evidence.py +20 -11
- package/scripts/serp_guard.py +13 -1
- package/scripts/settings_page.py +1 -0
- package/scripts/single_flight.py +1 -1
- package/scripts/social_engines/hackernews_engine.py +2 -1
- package/scripts/social_engines/reddit_engine.py +2 -1
- package/scripts/social_engines/zhihu_engine.py +2 -1
- package/scripts/source_audit.py +42 -7
- package/scripts/source_discovery.py +611 -0
- package/scripts/sync_backends.py +45 -0
- package/scripts/usage_log.py +24 -9
- package/scripts/watch.py +3 -3
- package/scripts/zhihu_quota.py +2 -1
- package/sub-skills/argo-wide-research/SKILL.md +7 -5
- package/sub-skills/ego-search/{SKILL.md → README.md} +24 -47
- package/sub-skills/ego-search/scripts/ego_search.py +195 -19
- package/sub-skills/ego-search/scripts/pacing.py +291 -0
- package/sub-skills/ego-search/scripts/quality.py +262 -6
- package/sub-skills/ego-search/scripts/runtime.py +7 -1
- package/sub-skills/ego-search/scripts/site_profiles.py +157 -0
- package/sub-skills/ego-search/scripts/webbridge_adapter.py +7 -1
- package/sub-skills/js-run/{SKILL.md → README.md} +3 -20
- package/sub-skills/local-search/{SKILL.md → README.md} +3 -8
- package/sub-skills/local-search/engine_registry.py +32 -7
- package/sub-skills/local-seek/SKILL.md +20 -22
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @taxueseek/argo-dsh — 工作台 I/O 与进程执行辅助(CLI 定位、静态资源缓存、定时监控持久化)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { spawn } from 'node:child_process'
|
|
6
|
+
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, renameSync, statSync, unlinkSync, writeFileSync } from 'node:fs'
|
|
7
|
+
import { homedir } from 'node:os'
|
|
8
|
+
import { dirname, join } from 'node:path'
|
|
9
|
+
import { fileURLToPath } from 'node:url'
|
|
10
|
+
import { resolveStateDir } from './diagnostics.js'
|
|
11
|
+
|
|
12
|
+
const HERE = dirname(fileURLToPath(import.meta.url))
|
|
13
|
+
const MONOREPO_ARGO_BIN = join(HERE, '..', '..', '..', 'bin', 'argo')
|
|
14
|
+
// install.sh 默认安装根(ARGO_HOME 可改,此处只探测默认路径——探测不到就走
|
|
15
|
+
// console script 的 PATH 兜底,不猜 site-packages 里的 wheel _data 布局)
|
|
16
|
+
const INSTALL_VENV_ARGO_BIN = join(homedir(), '.local', 'share', 'argo', '.venv', 'bin', 'argo')
|
|
17
|
+
export const WATCH_STORE_FILE = join(homedir(), '.config', 'argo', 'workbench-watches.json')
|
|
18
|
+
|
|
19
|
+
export function mergedLaunchdPath(env = {}) {
|
|
20
|
+
const extraPath = ['/opt/homebrew/bin', '/usr/local/bin', join(homedir(), '.local', 'bin')].join(':')
|
|
21
|
+
const basePath = env.PATH || process.env.PATH || ''
|
|
22
|
+
return basePath ? `${extraPath}:${basePath}` : extraPath
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// 2026-11-20 审计:npm 发布版插件装在 DSH 缓存目录时 MONOREPO_ARGO_BIN 不存在,
|
|
26
|
+
// 裸名 'argo' 又依赖 PATH——launchd/受限 PATH 下 venv console script 可能不可达。
|
|
27
|
+
// 修法加候选不重排:显式 ARGO_BIN 最优先(用户指路零猜测),其次 monorepo、
|
|
28
|
+
// install.sh 默认 venv,最后裸名走 PATH。
|
|
29
|
+
export function resolveArgoBin(env = {}) {
|
|
30
|
+
const explicit = env.ARGO_BIN || process.env.ARGO_BIN
|
|
31
|
+
if (explicit) return explicit
|
|
32
|
+
if (existsSync(MONOREPO_ARGO_BIN)) return MONOREPO_ARGO_BIN
|
|
33
|
+
if (existsSync(INSTALL_VENV_ARGO_BIN)) return INSTALL_VENV_ARGO_BIN
|
|
34
|
+
return 'argo'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function runArgoCli(args, { env = {}, stdin = null, timeoutMs = 30000, signal = null } = {}) {
|
|
38
|
+
const mergedPath = mergedLaunchdPath(env)
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
if (signal?.aborted) { reject(new Error('aborted')); return }
|
|
41
|
+
const child = spawn(resolveArgoBin({ ...env, PATH: mergedPath }), args, {
|
|
42
|
+
env: { ...process.env, ...env, PATH: mergedPath },
|
|
43
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
44
|
+
})
|
|
45
|
+
const out = []
|
|
46
|
+
const err = []
|
|
47
|
+
const timer = setTimeout(() => {
|
|
48
|
+
// 超时路径也要摘掉 abort 监听器:长生命周期 AbortSignal 下残留会累积
|
|
49
|
+
signal?.removeEventListener('abort', onAbort)
|
|
50
|
+
child.kill('SIGTERM')
|
|
51
|
+
reject(new Error(`argo ${args[0] || ''} timeout (${timeoutMs}ms)`))
|
|
52
|
+
}, timeoutMs)
|
|
53
|
+
if (typeof timer.unref === 'function') timer.unref()
|
|
54
|
+
const onAbort = () => {
|
|
55
|
+
clearTimeout(timer)
|
|
56
|
+
child.kill('SIGTERM')
|
|
57
|
+
reject(new Error('aborted'))
|
|
58
|
+
}
|
|
59
|
+
signal?.addEventListener('abort', onAbort, { once: true })
|
|
60
|
+
child.stdout.on('data', d => out.push(d))
|
|
61
|
+
child.stderr.on('data', d => err.push(d))
|
|
62
|
+
child.on('error', (e) => {
|
|
63
|
+
clearTimeout(timer)
|
|
64
|
+
signal?.removeEventListener('abort', onAbort)
|
|
65
|
+
reject(e)
|
|
66
|
+
})
|
|
67
|
+
child.on('close', (code) => {
|
|
68
|
+
clearTimeout(timer)
|
|
69
|
+
signal?.removeEventListener('abort', onAbort)
|
|
70
|
+
const text = Buffer.concat(out).toString('utf8').trim()
|
|
71
|
+
if (code !== 0 && !text) {
|
|
72
|
+
reject(new Error(Buffer.concat(err).toString('utf8').trim() || `argo exit ${code}`))
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
resolve(JSON.parse(text || '{}'))
|
|
77
|
+
} catch {
|
|
78
|
+
reject(new Error(`invalid json from argo ${args[0] || ''}`))
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
if (stdin !== null && stdin !== undefined) {
|
|
82
|
+
child.stdin.end(typeof stdin === 'string' ? stdin : JSON.stringify(stdin))
|
|
83
|
+
} else {
|
|
84
|
+
child.stdin.end()
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const staticAssetCache = new Map()
|
|
90
|
+
|
|
91
|
+
export function readStaticAssetCached(filePath) {
|
|
92
|
+
const st = statSync(filePath)
|
|
93
|
+
const hit = staticAssetCache.get(filePath)
|
|
94
|
+
if (hit && hit.mtimeMs === st.mtimeMs && hit.size === st.size) {
|
|
95
|
+
return hit.text
|
|
96
|
+
}
|
|
97
|
+
const text = readFileSync(filePath, 'utf8')
|
|
98
|
+
staticAssetCache.set(filePath, { mtimeMs: st.mtimeMs, size: st.size, text })
|
|
99
|
+
return text
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function loadWatches() {
|
|
103
|
+
try {
|
|
104
|
+
const raw = readFileSync(WATCH_STORE_FILE, 'utf8')
|
|
105
|
+
const parsed = JSON.parse(raw)
|
|
106
|
+
return Array.isArray(parsed) ? parsed : []
|
|
107
|
+
} catch {
|
|
108
|
+
return []
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function saveWatches(items) {
|
|
113
|
+
try {
|
|
114
|
+
mkdirSync(dirname(WATCH_STORE_FILE), { recursive: true })
|
|
115
|
+
const uniq = `${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2, 6)}`
|
|
116
|
+
const tmp = `${WATCH_STORE_FILE}.tmp.${uniq}`
|
|
117
|
+
writeFileSync(tmp, JSON.stringify(items, null, 2), 'utf8')
|
|
118
|
+
renameSync(tmp, WATCH_STORE_FILE)
|
|
119
|
+
} catch { /* ignore */ }
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// 跨进程状态文件互斥(wx 独占创建,语义对齐 scripts/pacing.py 的非阻塞文件锁):
|
|
123
|
+
// 抢不到返回 null 让调用方让路;崩溃残留超 staleMs 强取自愈。
|
|
124
|
+
// 热榜与 watches 共用同一实现,消灭各自手抄(2026-11-21 审计:锁方案四家并存)。
|
|
125
|
+
export function acquireStateFileLock(file, staleMs = 5 * 60 * 1000) {
|
|
126
|
+
try {
|
|
127
|
+
return { fd: openSync(file, 'wx'), lockFile: file }
|
|
128
|
+
} catch (err) {
|
|
129
|
+
if (err?.code !== 'EEXIST') return null
|
|
130
|
+
try {
|
|
131
|
+
if (Date.now() - statSync(file).mtimeMs > staleMs) {
|
|
132
|
+
unlinkSync(file)
|
|
133
|
+
return { fd: openSync(file, 'wx'), lockFile: file }
|
|
134
|
+
}
|
|
135
|
+
} catch { /* 对方刚释放或刚重建,本轮回让路 */ }
|
|
136
|
+
return null
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function releaseStateFileLock(lock) {
|
|
141
|
+
if (!lock) return
|
|
142
|
+
try { closeSync(lock.fd) } catch { /* ignore */ }
|
|
143
|
+
try { unlinkSync(lock.lockFile) } catch { /* ignore */ }
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// watches 唯一真源是磁盘文件:读-改-写全程持锁,内存副本只作缓存。
|
|
147
|
+
// 旧「内存快照 + 全量覆盖写」在多宿主下互相抹改(2026-11-21 审计 P1)。
|
|
148
|
+
// 返回 null 表示锁被占(另一宿主写盘中),调用方按忙处理。
|
|
149
|
+
export function mutateWatches(mutator) {
|
|
150
|
+
const lock = acquireStateFileLock(`${WATCH_STORE_FILE}.lock`)
|
|
151
|
+
if (!lock) return null
|
|
152
|
+
try {
|
|
153
|
+
const next = mutator(loadWatches())
|
|
154
|
+
if (Array.isArray(next)) saveWatches(next)
|
|
155
|
+
return Array.isArray(next) ? next : loadWatches()
|
|
156
|
+
} finally {
|
|
157
|
+
releaseStateFileLock(lock)
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function breakerFilePath() {
|
|
162
|
+
return join(resolveStateDir(), 'circuit_breaker.json')
|
|
163
|
+
}
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @taxueseek/argo-dsh — 工作台样式与安全 Markdown 渲染器
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const CSS = `
|
|
6
|
+
.aw-root {
|
|
7
|
+
--aw-brand: #2563eb;
|
|
8
|
+
--aw-brand-strong: #1d4ed8;
|
|
9
|
+
--aw-brand-soft: rgba(37, 99, 235, 0.10);
|
|
10
|
+
--aw-brand-ring: rgba(37, 99, 235, 0.25);
|
|
11
|
+
--aw-grad: linear-gradient(135deg, #0ea5e9, #2563eb 52%, #4f46e5);
|
|
12
|
+
--aw-bg: var(--dsw-alias-bg-base, #f8fafc);
|
|
13
|
+
--aw-layer: var(--dsw-alias-bg-layer-1, #ffffff);
|
|
14
|
+
--aw-sunken: var(--dsw-alias-bg-module-platform, #f1f5f9);
|
|
15
|
+
--aw-text: var(--dsw-alias-label-primary, #0f172a);
|
|
16
|
+
--aw-text-2: var(--dsw-alias-label-secondary, #475569);
|
|
17
|
+
--aw-text-3: var(--dsw-alias-label-tertiary, #64748b);
|
|
18
|
+
--aw-border: var(--dsw-alias-border-l1, rgba(15, 23, 42, 0.10));
|
|
19
|
+
--aw-border-2: var(--dsw-alias-border-l2, rgba(15, 23, 42, 0.16));
|
|
20
|
+
--aw-shadow: var(--dsw-elevation-panel, 0 2px 10px rgba(15, 23, 42, 0.05));
|
|
21
|
+
--aw-shadow-hi: var(--dsw-elevation-prominent, 0 10px 28px rgba(15, 23, 42, 0.10));
|
|
22
|
+
--aw-ok: var(--dsw-alias-state-success-primary, #16a34a);
|
|
23
|
+
--aw-warn: var(--dsw-alias-state-warn-primary, #d97706);
|
|
24
|
+
--aw-err: var(--dsw-alias-state-error-primary, #dc2626);
|
|
25
|
+
position: relative;
|
|
26
|
+
height: 100%;
|
|
27
|
+
width: 100%;
|
|
28
|
+
overflow-y: auto;
|
|
29
|
+
background: var(--aw-bg);
|
|
30
|
+
color: var(--aw-text);
|
|
31
|
+
font-family: var(--dsw-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
|
|
32
|
+
}
|
|
33
|
+
body[data-ds-dark-theme] .aw-root {
|
|
34
|
+
--aw-brand: #60a5fa;
|
|
35
|
+
--aw-brand-strong: #93c5fd;
|
|
36
|
+
--aw-brand-soft: rgba(96, 165, 250, 0.15);
|
|
37
|
+
--aw-brand-ring: rgba(96, 165, 250, 0.32);
|
|
38
|
+
}
|
|
39
|
+
.aw-hero {
|
|
40
|
+
min-height: 100%;
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
padding: 40px 24px 56px;
|
|
46
|
+
background-image: radial-gradient(58% 38% at 50% 0%, rgba(234, 88, 12, 0.06), transparent 72%);
|
|
47
|
+
}
|
|
48
|
+
.aw-hero-top {
|
|
49
|
+
position: absolute; top: 14px; right: 18px; display: flex; gap: 8px; align-items: center;
|
|
50
|
+
}
|
|
51
|
+
.aw-hero-inner { width: 100%; max-width: 780px; display: flex; flex-direction: column; align-items: center; }
|
|
52
|
+
.aw-slogan {
|
|
53
|
+
font-size: 30px; font-weight: 600; letter-spacing: 0.20em; margin: 0 0 10px;
|
|
54
|
+
text-align: center; color: var(--aw-text);
|
|
55
|
+
}
|
|
56
|
+
.aw-sub { font-size: 13px; color: var(--aw-text-3); margin: 0 0 24px; text-align: center; }
|
|
57
|
+
.aw-box {
|
|
58
|
+
width: 100%; background: var(--aw-layer); border: 1px solid var(--aw-border-2);
|
|
59
|
+
border-radius: 20px; padding: 14px 16px 12px; box-shadow: var(--aw-shadow);
|
|
60
|
+
transition: border-color .18s, box-shadow .18s;
|
|
61
|
+
}
|
|
62
|
+
.aw-box:focus-within { border-color: var(--aw-brand); box-shadow: 0 0 0 3px var(--aw-brand-ring), var(--aw-shadow); }
|
|
63
|
+
.aw-textarea {
|
|
64
|
+
width: 100%; border: none; outline: none; resize: none; background: transparent;
|
|
65
|
+
color: var(--aw-text); font-size: 15px; line-height: 1.6; min-height: 54px; font-family: inherit;
|
|
66
|
+
}
|
|
67
|
+
.aw-box-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
|
|
68
|
+
.aw-modes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
|
|
69
|
+
.aw-mode-btn {
|
|
70
|
+
border: 1px solid var(--aw-border); background: var(--aw-sunken); color: var(--aw-text-2);
|
|
71
|
+
border-radius: 999px; padding: 5px 13px; font-size: 12px; cursor: pointer; transition: all .15s;
|
|
72
|
+
}
|
|
73
|
+
.aw-mode-btn:hover { border-color: var(--aw-brand); color: var(--aw-text); }
|
|
74
|
+
.aw-mode-btn.active {
|
|
75
|
+
background: var(--aw-brand-soft); border-color: var(--aw-brand); color: var(--aw-brand); font-weight: 600;
|
|
76
|
+
}
|
|
77
|
+
.aw-topic-chip {
|
|
78
|
+
display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
|
|
79
|
+
background: rgba(79, 70, 229, 0.12); border: 1px solid rgba(79, 70, 229, 0.35);
|
|
80
|
+
color: var(--aw-brand); font-size: 12px; font-weight: 600;
|
|
81
|
+
}
|
|
82
|
+
.aw-topic-chip button {
|
|
83
|
+
border: none; background: transparent; color: inherit; cursor: pointer; font-size: 13px; padding: 0 2px; line-height: 1;
|
|
84
|
+
}
|
|
85
|
+
.aw-send {
|
|
86
|
+
width: 34px; height: 34px; border-radius: 999px; border: none; cursor: pointer;
|
|
87
|
+
background: var(--aw-grad); color: #fff; display: inline-flex; align-items: center; justify-content: center;
|
|
88
|
+
flex-shrink: 0; transition: transform .15s, opacity .15s;
|
|
89
|
+
}
|
|
90
|
+
.aw-send:disabled { opacity: 0.45; cursor: not-allowed; }
|
|
91
|
+
.aw-send:not(:disabled):hover { transform: translateY(-1px); }
|
|
92
|
+
|
|
93
|
+
.aw-sec-head {
|
|
94
|
+
width: 100%; display: flex; align-items: center; justify-content: space-between;
|
|
95
|
+
margin: 26px 0 10px; font-size: 12px; font-weight: 600; color: var(--aw-text-3);
|
|
96
|
+
}
|
|
97
|
+
.aw-presets { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 10px; }
|
|
98
|
+
.aw-preset {
|
|
99
|
+
display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
|
|
100
|
+
text-align: left; background: var(--aw-layer); border: 1px solid var(--aw-border); border-radius: 14px;
|
|
101
|
+
padding: 13px 14px; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s;
|
|
102
|
+
}
|
|
103
|
+
.aw-preset:hover { transform: translateY(-2px); border-color: var(--aw-brand); box-shadow: var(--aw-shadow); }
|
|
104
|
+
.aw-preset.selected { border-color: var(--aw-brand); background: var(--aw-brand-soft); }
|
|
105
|
+
.aw-preset-tag { font-size: 13px; color: var(--aw-text); font-weight: 600; }
|
|
106
|
+
.aw-preset-desc { font-size: 12px; color: var(--aw-text-2); line-height: 1.45; }
|
|
107
|
+
.aw-preset-try {
|
|
108
|
+
align-self: flex-start; font-size: 11px; color: var(--aw-brand); background: transparent;
|
|
109
|
+
border: none; padding: 0; cursor: pointer; font-weight: 600;
|
|
110
|
+
}
|
|
111
|
+
.aw-preset-try:hover { text-decoration: underline; }
|
|
112
|
+
|
|
113
|
+
.aw-topbar {
|
|
114
|
+
position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px;
|
|
115
|
+
padding: 10px 18px; background: var(--aw-bg); border-bottom: 1px solid var(--aw-border);
|
|
116
|
+
backdrop-filter: blur(10px); flex-wrap: wrap;
|
|
117
|
+
}
|
|
118
|
+
.aw-icon-btn {
|
|
119
|
+
height: 32px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--aw-border);
|
|
120
|
+
background: var(--aw-layer); color: var(--aw-text-2); font-size: 12px; cursor: pointer;
|
|
121
|
+
display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
|
|
122
|
+
}
|
|
123
|
+
.aw-icon-btn:hover { border-color: var(--aw-brand); color: var(--aw-text); }
|
|
124
|
+
.aw-select {
|
|
125
|
+
height: 32px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--aw-border);
|
|
126
|
+
background: var(--aw-layer); color: var(--aw-text); font-size: 12px; outline: none; cursor: pointer;
|
|
127
|
+
}
|
|
128
|
+
.aw-top-form {
|
|
129
|
+
flex: 1; min-width: 220px; max-width: 560px; display: flex; align-items: center; gap: 8px;
|
|
130
|
+
background: var(--aw-layer); border: 1px solid var(--aw-border-2); border-radius: 14px; padding: 4px 6px 4px 12px;
|
|
131
|
+
}
|
|
132
|
+
.aw-top-input { flex: 1; border: none; outline: none; background: transparent; color: var(--aw-text); font-size: 13px; min-width: 0; }
|
|
133
|
+
.aw-stat-pill {
|
|
134
|
+
font-size: 12px; color: var(--aw-text-2); background: var(--aw-sunken); border: 1px solid var(--aw-border);
|
|
135
|
+
border-radius: 999px; padding: 4px 11px; white-space: nowrap; font-variant-numeric: tabular-nums;
|
|
136
|
+
}
|
|
137
|
+
.aw-main {
|
|
138
|
+
max-width: 1260px; margin: 0 auto; padding: 20px 22px 48px;
|
|
139
|
+
display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr); gap: 24px; align-items: start;
|
|
140
|
+
}
|
|
141
|
+
@media (max-width: 920px) { .aw-main { grid-template-columns: 1fr; } }
|
|
142
|
+
.aw-q-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
|
|
143
|
+
.aw-q-title { font-size: 21px; font-weight: 600; margin: 0; line-height: 1.35; }
|
|
144
|
+
.aw-badge {
|
|
145
|
+
font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
|
|
146
|
+
background: var(--aw-brand-soft); color: var(--aw-brand);
|
|
147
|
+
}
|
|
148
|
+
.aw-progress {
|
|
149
|
+
display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px;
|
|
150
|
+
background: var(--aw-sunken); border: 1px solid var(--aw-border); font-size: 12px; color: var(--aw-text-2);
|
|
151
|
+
margin-bottom: 16px;
|
|
152
|
+
}
|
|
153
|
+
.aw-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--aw-brand); animation: awPulse 1.3s infinite; }
|
|
154
|
+
@keyframes awPulse { 0%,100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }
|
|
155
|
+
.aw-turn { margin-bottom: 22px; }
|
|
156
|
+
.aw-turn-q {
|
|
157
|
+
font-size: 14px; font-weight: 600; padding: 9px 14px; border-radius: 12px;
|
|
158
|
+
background: var(--aw-brand-soft); color: var(--aw-text); margin: 16px 0 12px;
|
|
159
|
+
}
|
|
160
|
+
.aw-md { font-size: 15px; line-height: 1.82; color: var(--aw-text); }
|
|
161
|
+
.aw-md h1, .aw-md h2, .aw-md h3 { margin: 18px 0 8px; font-weight: 600; line-height: 1.4; }
|
|
162
|
+
.aw-md h2 { font-size: 17px; padding-left: 10px; border-left: 3px solid var(--aw-brand); }
|
|
163
|
+
.aw-md h3 { font-size: 15px; }
|
|
164
|
+
.aw-md p { margin: 0 0 10px; }
|
|
165
|
+
.aw-md ul, .aw-md ol { margin: 0 0 10px; padding-left: 20px; }
|
|
166
|
+
.aw-md li { margin-bottom: 4px; }
|
|
167
|
+
.aw-md blockquote {
|
|
168
|
+
margin: 10px 0; padding: 6px 12px; border-left: 3px solid var(--aw-border-2);
|
|
169
|
+
background: var(--aw-sunken); border-radius: 0 8px 8px 0; color: var(--aw-text-2);
|
|
170
|
+
}
|
|
171
|
+
.aw-md table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
|
|
172
|
+
.aw-md th, .aw-md td { border: 1px solid var(--aw-border); padding: 7px 10px; text-align: left; }
|
|
173
|
+
.aw-md th { background: var(--aw-sunken); font-weight: 600; }
|
|
174
|
+
.aw-md code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--aw-sunken); padding: 1px 5px; border-radius: 5px; }
|
|
175
|
+
.aw-codebox { margin: 10px 0; border: 1px solid var(--aw-border); border-radius: 12px; overflow: hidden; background: var(--aw-sunken); }
|
|
176
|
+
.aw-codehead { display: flex; justify-content: space-between; align-items: center; padding: 5px 10px; font-size: 11px; color: var(--aw-text-3); border-bottom: 1px solid var(--aw-border); }
|
|
177
|
+
.aw-codepre { margin: 0; padding: 10px 12px; overflow-x: auto; font-size: 13px; line-height: 1.55; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
|
|
178
|
+
.aw-cite {
|
|
179
|
+
display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px;
|
|
180
|
+
padding: 0 5px; margin: 0 2px; border-radius: 6px; font-size: 11px; font-weight: 600;
|
|
181
|
+
vertical-align: 1px; border: none; font-variant-numeric: tabular-nums;
|
|
182
|
+
}
|
|
183
|
+
.aw-cite.ok { background: var(--aw-brand-soft); color: var(--aw-brand); cursor: pointer; }
|
|
184
|
+
.aw-cite.ok:hover { background: var(--aw-brand); color: #fff; }
|
|
185
|
+
.aw-cite.miss { background: var(--aw-sunken); color: var(--aw-text-3); cursor: default; }
|
|
186
|
+
|
|
187
|
+
.aw-followup {
|
|
188
|
+
margin-top: 20px; display: flex; gap: 8px; align-items: center;
|
|
189
|
+
background: var(--aw-layer); border: 1px solid var(--aw-border-2); border-radius: 16px; padding: 6px 8px 6px 14px;
|
|
190
|
+
box-shadow: var(--aw-shadow);
|
|
191
|
+
}
|
|
192
|
+
.aw-followup input { flex: 1; border: none; outline: none; background: transparent; color: var(--aw-text); font-size: 14px; }
|
|
193
|
+
|
|
194
|
+
.aw-right-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
|
|
195
|
+
.aw-filters { display: flex; gap: 6px; flex-wrap: wrap; }
|
|
196
|
+
.aw-filter {
|
|
197
|
+
font-size: 11px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--aw-border);
|
|
198
|
+
background: var(--aw-layer); color: var(--aw-text-2); cursor: pointer;
|
|
199
|
+
}
|
|
200
|
+
.aw-filter.active { background: var(--aw-brand-soft); border-color: var(--aw-brand); color: var(--aw-brand); font-weight: 600; }
|
|
201
|
+
.aw-cards { display: flex; flex-direction: column; gap: 10px; }
|
|
202
|
+
.aw-card {
|
|
203
|
+
background: var(--aw-layer); border: 1px solid var(--aw-border); border-radius: 14px; padding: 13px 14px;
|
|
204
|
+
box-shadow: var(--aw-shadow); transition: transform .15s, border-color .2s, box-shadow .2s;
|
|
205
|
+
}
|
|
206
|
+
.aw-card:hover { transform: translateY(-1px); box-shadow: var(--aw-shadow-hi); }
|
|
207
|
+
.aw-card.flash { border-color: var(--aw-brand); box-shadow: 0 0 0 3px var(--aw-brand-ring); }
|
|
208
|
+
.aw-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 11px; color: var(--aw-text-3); }
|
|
209
|
+
.aw-card-src { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
|
|
210
|
+
.aw-idx {
|
|
211
|
+
display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
|
|
212
|
+
border-radius: 5px; background: var(--aw-brand-soft); color: var(--aw-brand); font-weight: 600; flex-shrink: 0;
|
|
213
|
+
}
|
|
214
|
+
.aw-verified {
|
|
215
|
+
font-size: 10px; padding: 1px 6px; border-radius: 999px; background: rgba(22, 163, 74, 0.12);
|
|
216
|
+
color: var(--aw-ok); font-weight: 600; flex-shrink: 0;
|
|
217
|
+
}
|
|
218
|
+
.aw-card-quote {
|
|
219
|
+
font-size: 13px; line-height: 1.65; color: var(--aw-text-2); margin: 0 0 8px;
|
|
220
|
+
padding-left: 9px; border-left: 2px solid var(--aw-border-2);
|
|
221
|
+
}
|
|
222
|
+
.aw-card-link {
|
|
223
|
+
display: flex; align-items: center; justify-content: space-between; gap: 8px;
|
|
224
|
+
font-size: 13px; font-weight: 600; color: var(--aw-text); text-decoration: none;
|
|
225
|
+
}
|
|
226
|
+
.aw-card-link:hover { color: var(--aw-brand); }
|
|
227
|
+
.aw-popover {
|
|
228
|
+
position: fixed; top: 54px; right: 18px; z-index: 60; width: 380px; max-height: 74vh; overflow-y: auto;
|
|
229
|
+
background: var(--aw-layer); border: 1px solid var(--aw-border-2); border-radius: 14px;
|
|
230
|
+
padding: 14px; box-shadow: var(--aw-shadow-hi); font-size: 12px;
|
|
231
|
+
}
|
|
232
|
+
.aw-watch-row {
|
|
233
|
+
padding: 10px 0; border-bottom: 1px solid var(--aw-border); display: flex; flex-direction: column; gap: 5px;
|
|
234
|
+
}
|
|
235
|
+
.aw-watch-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
|
|
236
|
+
.aw-sel-pill {
|
|
237
|
+
position: fixed; z-index: 90; display: inline-flex; align-items: center; gap: 6px;
|
|
238
|
+
padding: 6px 12px; border-radius: 999px; border: 1px solid var(--aw-border-2);
|
|
239
|
+
background: var(--aw-layer); color: var(--aw-text); box-shadow: var(--aw-shadow-hi);
|
|
240
|
+
font-size: 12px; font-weight: 600; cursor: pointer;
|
|
241
|
+
}
|
|
242
|
+
.aw-sel-pill:hover { border-color: #2563eb; color: #2563eb; }
|
|
243
|
+
`
|
|
244
|
+
|
|
245
|
+
function renderInline(h, text, cards, onCite) {
|
|
246
|
+
const parts = []
|
|
247
|
+
const tokenRe = /(\[\d+\]|`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\(https?:\/\/[^)]+\))/g
|
|
248
|
+
let last = 0
|
|
249
|
+
let m
|
|
250
|
+
let k = 0
|
|
251
|
+
while ((m = tokenRe.exec(text)) !== null) {
|
|
252
|
+
if (m.index > last) parts.push(text.slice(last, m.index))
|
|
253
|
+
const tok = m[0]
|
|
254
|
+
if (tok.startsWith('[') && /^\[(\d+)\]$/.test(tok)) {
|
|
255
|
+
const idx = Number(tok.slice(1, -1))
|
|
256
|
+
const card = cards.find(c => c.index === idx)
|
|
257
|
+
parts.push(h('button', {
|
|
258
|
+
key: `c-${k++}`,
|
|
259
|
+
type: 'button',
|
|
260
|
+
className: `aw-cite ${card ? 'ok' : 'miss'}`,
|
|
261
|
+
title: card ? card.title : '未匹配到对应证据卡',
|
|
262
|
+
onClick: card ? () => onCite(card.id) : undefined,
|
|
263
|
+
}, String(idx)))
|
|
264
|
+
} else if (tok.startsWith('`')) {
|
|
265
|
+
parts.push(h('code', { key: `cd-${k++}` }, tok.slice(1, -1)))
|
|
266
|
+
} else if (tok.startsWith('**')) {
|
|
267
|
+
parts.push(h('strong', { key: `b-${k++}` }, tok.slice(2, -2)))
|
|
268
|
+
} else {
|
|
269
|
+
const lm = tok.match(/^\[([^\]]+)\]\((https?:\/\/[^)]+)\)$/)
|
|
270
|
+
if (lm) {
|
|
271
|
+
parts.push(h('a', {
|
|
272
|
+
key: `a-${k++}`,
|
|
273
|
+
href: lm[2],
|
|
274
|
+
target: '_blank',
|
|
275
|
+
rel: 'noopener noreferrer',
|
|
276
|
+
style: { color: 'var(--aw-brand)' },
|
|
277
|
+
}, lm[1]))
|
|
278
|
+
} else {
|
|
279
|
+
parts.push(tok)
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
last = m.index + tok.length
|
|
283
|
+
}
|
|
284
|
+
if (last < text.length) parts.push(text.slice(last))
|
|
285
|
+
return parts
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export function renderMarkdown(h, markdown, cards, onCite) {
|
|
289
|
+
const lines = String(markdown || '').split('\n')
|
|
290
|
+
const blocks = []
|
|
291
|
+
let i = 0
|
|
292
|
+
let key = 0
|
|
293
|
+
|
|
294
|
+
while (i < lines.length) {
|
|
295
|
+
const line = lines[i]
|
|
296
|
+
if (line.trim().startsWith('```')) {
|
|
297
|
+
const lang = line.trim().slice(3).trim() || 'text'
|
|
298
|
+
const codeLines = []
|
|
299
|
+
i++
|
|
300
|
+
while (i < lines.length && !lines[i].trim().startsWith('```')) {
|
|
301
|
+
codeLines.push(lines[i])
|
|
302
|
+
i++
|
|
303
|
+
}
|
|
304
|
+
i++
|
|
305
|
+
const codeText = codeLines.join('\n')
|
|
306
|
+
blocks.push(h('div', { key: `cb-${key++}`, className: 'aw-codebox' },
|
|
307
|
+
h('div', { className: 'aw-codehead' },
|
|
308
|
+
h('span', null, lang),
|
|
309
|
+
h('button', {
|
|
310
|
+
type: 'button',
|
|
311
|
+
className: 'aw-filter',
|
|
312
|
+
onClick: () => navigator.clipboard?.writeText?.(codeText),
|
|
313
|
+
}, '复制')),
|
|
314
|
+
h('pre', { className: 'aw-codepre' }, codeText)))
|
|
315
|
+
continue
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (line.includes('|') && i + 1 < lines.length && /^\s*\|?[\s:-]+\|/.test(lines[i + 1])) {
|
|
319
|
+
const parseRow = r => r.trim().replace(/^\|/, '').replace(/\|$/, '').split('|').map(s => s.trim())
|
|
320
|
+
const headers = parseRow(line)
|
|
321
|
+
i += 2
|
|
322
|
+
const rows = []
|
|
323
|
+
while (i < lines.length && lines[i].includes('|') && lines[i].trim() !== '') {
|
|
324
|
+
rows.push(parseRow(lines[i]))
|
|
325
|
+
i++
|
|
326
|
+
}
|
|
327
|
+
blocks.push(h('table', { key: `tb-${key++}` },
|
|
328
|
+
h('thead', null, h('tr', null, headers.map((hd, idx) => h('th', { key: idx }, renderInline(h, hd, cards, onCite))))),
|
|
329
|
+
h('tbody', null, rows.map((r, rIdx) => h('tr', { key: rIdx }, r.map((cell, cIdx) => h('td', { key: cIdx }, renderInline(h, cell, cards, onCite))))))))
|
|
330
|
+
continue
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const hm = line.match(/^(#{1,3})\s+(.+)$/)
|
|
334
|
+
if (hm) {
|
|
335
|
+
const tag = `h${hm[1].length}`
|
|
336
|
+
blocks.push(h(tag, { key: `h-${key++}` }, renderInline(h, hm[2], cards, onCite)))
|
|
337
|
+
i++
|
|
338
|
+
continue
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (line.trim().startsWith('> ')) {
|
|
342
|
+
const qLines = []
|
|
343
|
+
while (i < lines.length && lines[i].trim().startsWith('> ')) {
|
|
344
|
+
qLines.push(lines[i].trim().slice(2))
|
|
345
|
+
i++
|
|
346
|
+
}
|
|
347
|
+
blocks.push(h('blockquote', { key: `bq-${key++}` }, renderInline(h, qLines.join(' '), cards, onCite)))
|
|
348
|
+
continue
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
if (/^\s*[-*]\s+/.test(line)) {
|
|
352
|
+
const items = []
|
|
353
|
+
while (i < lines.length && /^\s*[-*]\s+/.test(lines[i])) {
|
|
354
|
+
items.push(lines[i].replace(/^\s*[-*]\s+/, ''))
|
|
355
|
+
i++
|
|
356
|
+
}
|
|
357
|
+
blocks.push(h('ul', { key: `ul-${key++}` }, items.map((it, idx) => h('li', { key: idx }, renderInline(h, it, cards, onCite)))))
|
|
358
|
+
continue
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (/^\s*\d+\.\s+/.test(line)) {
|
|
362
|
+
const items = []
|
|
363
|
+
while (i < lines.length && /^\s*\d+\.\s+/.test(lines[i])) {
|
|
364
|
+
items.push(lines[i].replace(/^\s*\d+\.\s+/, ''))
|
|
365
|
+
i++
|
|
366
|
+
}
|
|
367
|
+
blocks.push(h('ol', { key: `ol-${key++}` }, items.map((it, idx) => h('li', { key: idx }, renderInline(h, it, cards, onCite)))))
|
|
368
|
+
continue
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
if (line.trim() === '') {
|
|
372
|
+
i++
|
|
373
|
+
continue
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const pLines = [line]
|
|
377
|
+
i++
|
|
378
|
+
while (i < lines.length && lines[i].trim() !== '' && !/^(#{1,3}\s|```|>\s|\s*[-*]\s|\s*\d+\.\s)/.test(lines[i])) {
|
|
379
|
+
pLines.push(lines[i])
|
|
380
|
+
i++
|
|
381
|
+
}
|
|
382
|
+
blocks.push(h('p', { key: `p-${key++}` }, renderInline(h, pLines.join(' '), cards, onCite)))
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
return blocks
|
|
386
|
+
}
|