From 86b330558e3fb531c36341634e95601d5c6e4b52 Mon Sep 17 00:00:00 2001 From: Eric Zhu Date: Fri, 1 Nov 2024 18:30:53 +0800 Subject: [PATCH 1/2] fix: html-table-to-markdown-error --- apps/renderer/package.json | 1 + apps/renderer/src/lib/parse-html.ts | 3 ++- pnpm-lock.yaml | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/renderer/package.json b/apps/renderer/package.json index ccc6ff1740..b8385ce592 100644 --- a/apps/renderer/package.json +++ b/apps/renderer/package.json @@ -64,6 +64,7 @@ "lethargy": "1.0.9", "lodash-es": "4.17.21", "masonic": "4.0.1", + "mdast-util-gfm-table": "^2.0.0", "mdast-util-to-markdown": "^2.1.0", "nanoid": "5.0.7", "ofetch": "1.4.1", diff --git a/apps/renderer/src/lib/parse-html.ts b/apps/renderer/src/lib/parse-html.ts index 537a6aafe8..051e8fa117 100644 --- a/apps/renderer/src/lib/parse-html.ts +++ b/apps/renderer/src/lib/parse-html.ts @@ -6,6 +6,7 @@ import type { Components } from "hast-util-to-jsx-runtime" import { toJsxRuntime } from "hast-util-to-jsx-runtime" import { toMdast } from "hast-util-to-mdast" import { toText } from "hast-util-to-text" +import { gfmTableToMarkdown } from "mdast-util-gfm-table" import { toMarkdown } from "mdast-util-to-markdown" import { createElement } from "react" import { Fragment, jsx, jsxs } from "react/jsx-runtime" @@ -237,7 +238,7 @@ export const parseHtml = ( }, }), toText: () => toText(hastTree), - toMarkdown: () => toMarkdown(toMdast(hastTree)), + toMarkdown: () => toMarkdown(toMdast(hastTree), { extensions: [gfmTableToMarkdown()] }), } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7049d31c4f..c001c9701c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -474,6 +474,9 @@ importers: masonic: specifier: 4.0.1 version: 4.0.1(react@18.3.1) + mdast-util-gfm-table: + specifier: ^2.0.0 + version: 2.0.0 mdast-util-to-markdown: specifier: ^2.1.0 version: 2.1.0 From ef620b5f15901310f0fe9d83a9e7754cdaad9c58 Mon Sep 17 00:00:00 2001 From: ericyzhu Date: Fri, 1 Nov 2024 10:34:38 +0000 Subject: [PATCH 2/2] chore: auto-fix linting and formatting issues --- locales/app/ja.json | 1 - 1 file changed, 1 deletion(-) diff --git a/locales/app/ja.json b/locales/app/ja.json index 2816475f00..a864aea921 100644 --- a/locales/app/ja.json +++ b/locales/app/ja.json @@ -14,7 +14,6 @@ "achievement.list_subscribe_500": "500 リスト購読者", "achievement.list_subscribe_500_description": "あなたが作成したリストの購読者数が 500 人を超えました", "achievement.list_subscribe_50_description": "あなたが作成したリストの購読者数が 50 人を超えました", - "achievement.mint_more_power": "ハードコア プレイヤーになるとさらなる報酬を得られます ", "achievement.product_hunt_vote": "Product Hunt 投票者", "achievement.product_hunt_vote_description": "あなたは Product Hunt での Follow サポーターです", "activation.activate": "有効化",