\1',value)
value=re.sub(r'\*\*([^*]+)\*\*',r'\1',value)
def link(m):
dest=m[2]
if dest in ['操作手册_20261111.md','../操作手册_20261111.md']:dest='manual.html'
if dest=='鲲鹏长视频制作指南_20261111.md':dest='kunpeng.html'
if dest=='锚定工作室操作手册_20261111.md':dest='story.html'
if dest=='图生图与视频人物替换操作手册_20261112.md':dest='editing.html'
if dest=='design/2026-11-12-production-workflow-design.md':dest='production.html'
if dest=='自动长视频与音轨操作指南_20261126.md':dest='long-video.html'
if not (dest.startswith('https://') or dest in ['manual.html','kunpeng.html','story.html','editing.html','production.html','long-video.html']):return m[1]
return ''+m[1]+''
return re.sub(r'\[([^]]+)\]\(([^)]+)\)',link,value)
css='''body{margin:0;background:#f4f7f9;color:#1e293b;font:16px/1.85 "Microsoft YaHei",system-ui,sans-serif}a{color:#09685b}header{background:#112b32;color:#edf7f4;padding:28px max(5vw,20px)}header a{color:#a9ecda;margin-right:22px}main{max-width:1320px;margin:auto;display:grid;grid-template-columns:245px minmax(0,1fr);gap:30px;padding:28px}aside{align-self:start;position:sticky;top:20px;font-size:13px;max-height:90vh;overflow:auto}aside a{display:block;margin:7px 0}article{min-width:0;background:white;padding:36px;border-radius:12px;box-shadow:0 5px 30px #1330360a}h1{font-size:30px;line-height:1.5}h2{font-size:23px;margin-top:38px;border-bottom:1px solid #dbe5e9;padding-bottom:12px;scroll-margin-top:15px}h3{font-size:19px;margin-top:28px}p,li{overflow-wrap:anywhere}li{margin-bottom:10px}code{font:14px/1.6 Consolas,monospace;background:#edf2f5;padding:2px 5px;border-radius:4px;overflow-wrap:anywhere}pre{background:#102731;color:#d9ece7;padding:20px;overflow:auto;border-radius:8px}pre code{background:none;color:inherit;padding:0}blockquote{border-left:4px solid #60ae9a;margin:20px 0;padding:12px 20px;background:#eff7f4}.table-scroll{overflow:auto}table{border-collapse:collapse;width:100%;font-size:14px}th,td{border:1px solid #dbe5e9;padding:10px 12px;text-align:left;min-width:95px;vertical-align:top}th{background:#edf4f3}footer{margin-top:35px;color:#64748b;font-size:13px}@media(max-width:800px){main{display:block;padding:14px}aside{position:static;max-height:none;margin-bottom:20px}article{padding:20px}h1{font-size:25px}body{font-size:15px}}@media print{header,aside{display:none}main{display:block;padding:0}article{box-shadow:none;padding:0}h2{break-after:avoid}table{font-size:10px}a{color:inherit}}'''
manuals=[('操作手册_20261111.md','manual','操作手册'),('鲲鹏长视频制作指南_20261111.md','kunpeng','鲲鹏长视频制作指南'),('锚定工作室操作手册_20261111.md','story','锚定工作室操作手册'),('图生图与视频人物替换操作手册_20261112.md','editing','图生图与视频人物替换'),('design/2026-11-12-production-workflow-design.md','production','功能与生产流程完善方案'),('自动长视频与音轨操作指南_20261126.md','long-video','自动长视频与音轨操作指南')]
parser=argparse.ArgumentParser(description='Render published help manuals; omit --only to render all.')
parser.add_argument('--only',nargs='+',choices=[entry[1] for entry in manuals])
selected=parser.parse_args().only
rendered=0
for source,target,title in manuals:
if selected and target not in selected:continue
text=(root/'docs'/source).read_text(encoding='utf-8')
(out/(target+'.md')).write_text(text,encoding='utf-8')
lines=text.splitlines();parts=[];toc=[];i=0;seq=0;list_type=None
def close_list():
global list_type
if list_type:parts.append(''+list_type+'>');list_type=None
while i'+html.escape('\n'.join(block))+'');i+=1;continue
if s.startswith('|') and i+1| '+inline(c)+' | ' for c in rows[0])+'
|---|
| '+inline(c)+' | ' for c in row)+'
'+inline(s[2:])+'') else: item=re.match(r'^(?:([-]) |(\d+)\. )(.+)$',s) if item: kind='ul' if item[1] else 'ol' if list_type!=kind:close_list();parts.append('<'+kind+'>');list_type=kind parts.append('
'+inline(s)+'
') i+=1 close_list() page='