From a453ab5f168f0ce190a6a43ccfa62146fe2b5e58 Mon Sep 17 00:00:00 2001 From: Yanlong Wang Date: Tue, 4 Feb 2025 15:59:01 +0800 Subject: [PATCH] fix: content suffix for markdown respond format --- backend/functions/src/services/snapshot-formatter.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/functions/src/services/snapshot-formatter.ts b/backend/functions/src/services/snapshot-formatter.ts index 6d5a403..5743738 100644 --- a/backend/functions/src/services/snapshot-formatter.ts +++ b/backend/functions/src/services/snapshot-formatter.ts @@ -410,10 +410,6 @@ export class SnapshotFormatter extends AsyncService { Object.assign(f, formatted); const textRepresentation = (function (this: typeof formatted) { - if (mode.includes('markdown')) { - return this.content as string; - } - const mixins = []; if (this.publishedTime) { mixins.push(`Published Time: ${this.publishedTime}`); @@ -450,6 +446,11 @@ export class SnapshotFormatter extends AsyncService { mixins.push(`Warning: ${this.warning}`); } + if (mode.includes('markdown')) { + return `${mixins.length ? `${mixins.join('\n\n')}\n\n` : ''}${this.content} +${suffixMixins.length ? `\n${suffixMixins.join('\n\n')}\n` : ''}`; + } + return `Title: ${this.title} URL Source: ${this.url}