diff --git a/lib/v2/yuque/utils.js b/lib/v2/yuque/utils.js index a9da88c91..802c40d24 100644 --- a/lib/v2/yuque/utils.js +++ b/lib/v2/yuque/utils.js @@ -1,10 +1,12 @@ const card2Html = (elem, link) => { const name = elem.attr('name'); - const data = elem.attr('value')?.split('data:')[1]; - const value = JSON.parse(decodeURIComponent(data ?? '[]')); + const data = elem.attr('value')?.split('data:')[1]?.replace('undefined', ''); + const value = JSON.parse(decodeURIComponent(data || '[]')); let html = ''; switch (name) { case 'board': + case 'emoji': + case 'flowchart2': case 'image': case 'mindmap': case 'puml': @@ -35,6 +37,18 @@ const card2Html = (elem, link) => { case 'table': html = value.html; break; + case 'thirdparty': + case 'youku': + // YES, youku name with bilibli iframe + // https://www.yuque.com/api/docs/nn5lyk?book_id=297292&include_contributors=true + if (elem.attr('alias') === 'music163') { + html = ``; + } else if (elem.attr('alias') === 'bilibili' || elem.attr('alias') === undefined) { + html = ``; + } else { + throw Error(`Unhandled thirdparty on ${link}: ${elem.attr('alias')}`); + } + break; case 'video': // fake video src html = ``;