diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..07764a78d --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text eol=lf \ No newline at end of file diff --git a/lib/v2/zhihu/pin/utils.js b/lib/v2/zhihu/pin/utils.js index 635958324..a62ce085b 100644 --- a/lib/v2/zhihu/pin/utils.js +++ b/lib/v2/zhihu/pin/utils.js @@ -1,5 +1,47 @@ const { parseDate } = require('@/utils/parse-date'); +const generateDescription = (target, init) => + target.content.reduce((description, item) => { + switch (item.type) { + case 'text': + description += `
${item.content}
`; + break; + + case 'image': + description += ``; + break; + + case 'video': + try { + description += `