diff --git a/feishu-docx/src/markdown_renderer.ts b/feishu-docx/src/markdown_renderer.ts index 8838e40..f1bc4e6 100644 --- a/feishu-docx/src/markdown_renderer.ts +++ b/feishu-docx/src/markdown_renderer.ts @@ -344,14 +344,14 @@ export class MarkdownRenderer extends Renderer { let escape = true; if (style) { if (style.bold) { - preWrite = '**'; - postWrite = '**'; + preWrite = ''; + postWrite = ''; } else if (style.italic) { - preWrite = '_'; - postWrite = '_'; + preWrite = ''; + postWrite = ''; } else if (style.strikethrough) { - preWrite = '~~'; - postWrite = '~~'; + preWrite = ''; + postWrite = ''; } else if (style.underline) { preWrite = ''; postWrite = ''; diff --git a/feishu-docx/tests/fixtures/case0.expect.md b/feishu-docx/tests/fixtures/case0.expect.md index 6dd3943..56ef896 100644 --- a/feishu-docx/tests/fixtures/case0.expect.md +++ b/feishu-docx/tests/fixtures/case0.expect.md @@ -35,9 +35,9 @@ Feishu2Md 已开源并发布在 Github 中:https://github.com/Wsine/feishu2md -**下载 feishu2md **-** **得益于 golang 本身的多平台编译特性,我已经为 Windows/Linux/Mac 都预编译了该工具的可执行文件,可以直接从 [Github Release](https://github.com/Wsine/feishu2md/releases) 中下载,从压缩包中提取自己平台的 feishu2md 二进制可执行文件即可,建议放置在 PATH 路径中。 +下载 feishu2md - 得益于 golang 本身的多平台编译特性,我已经为 Windows/Linux/Mac 都预编译了该工具的可执行文件,可以直接从 [Github Release](https://github.com/Wsine/feishu2md/releases) 中下载,从压缩包中提取自己平台的 feishu2md 二进制可执行文件即可,建议放置在 PATH 路径中。 -**生成配置文件** - feishu2md 需要使用飞书的 Open API 提取飞书文档,因此需要配置相应的 App ID 和 App Secret 进行 API 的调用。首先,进入飞书的 [开发者后台](https://open.feishu.cn/app) 然后创建一个企业自建应用,信息可以任意填,发布但不必等待审核通过。然后在创建的应用页面中,找到「凭证与基础信息」,即可找到 App ID 和 App Secret 信息。 +生成配置文件 - feishu2md 需要使用飞书的 Open API 提取飞书文档,因此需要配置相应的 App ID 和 App Secret 进行 API 的调用。首先,进入飞书的 [开发者后台](https://open.feishu.cn/app) 然后创建一个企业自建应用,信息可以任意填,发布但不必等待审核通过。然后在创建的应用页面中,找到「凭证与基础信息」,即可找到 App ID 和 App Secret 信息。 @@ -51,7 +51,7 @@ Feishu2Md 已开源并发布在 Github 中:https://github.com/Wsine/feishu2md 将 App ID 和 App Secret 填入配置文件 config.json 中的相应位置。另外,image_dir 配置项为存放文档中图片的文件夹名称。 -**下载飞书文档** - 通过 `feishu2md 你的飞书文档链接` 直接下载,文档链接可以通过 分享 > 开启链接分享 > 复制链接 获得。 +下载飞书文档 - 通过 `feishu2md 你的飞书文档链接` 直接下载,文档链接可以通过 分享 > 开启链接分享 > 复制链接 获得。 @@ -69,5 +69,4 @@ feishu2md [一日一技:飞书文档转换为 Markdown](doccnrOvzeQ8BSnfsXj8jw 由于 lark_docs_md 是使用 golang 实现的,因此这也是我首次使用 golang 进行开发。对于开发小工具,整体的开发体验非常良好,而且还能编译得到二进制以及享受多平台编译的好处。工具可能还有一些不是很完善的地方,如有问题可以提 issue,我有时间会进行修复的。 -最后,欢迎试用,欢迎 PR ~ - +最后,欢迎试用,欢迎 PR ~ \ No newline at end of file diff --git a/feishu-docx/tests/fixtures/case1.expect.md b/feishu-docx/tests/fixtures/case1.expect.md index fe5f1de..d36cbe3 100644 --- a/feishu-docx/tests/fixtures/case1.expect.md +++ b/feishu-docx/tests/fixtures/case1.expect.md @@ -4,7 +4,7 @@ ## Overview -**Markdown** is created by [Daring Fireball](http://daringfireball.net/); the original guideline is [here](http://daringfireball.net/projects/markdown/syntax). Its syntax, however, varies between different parsers or editors. **Typora** is using [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown/). +Markdown is created by [Daring Fireball](http://daringfireball.net/); the original guideline is [here](http://daringfireball.net/projects/markdown/syntax). Its syntax, however, varies between different parsers or editors. Typora is using [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown/). [toc] @@ -103,13 +103,13 @@ puts markdown.to_html ### Math Blocks -You can render _LaTeX_ mathematical expressions using **MathJax**. +You can render LaTeX mathematical expressions using MathJax. -To add a mathematical expression, input `$$` and press the 'Return' key. This will trigger an input field which accepts _Tex/LaTex_ source. For example: +To add a mathematical expression, input `$$` and press the 'Return' key. This will trigger an input field which accepts Tex/LaTex source. For example: $$\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}\mathbf{i} & \mathbf{j} & \mathbf{k} \\\frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\\frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0 \\\end{vmatrix}$$ -In the markdown source file, the math block is a _LaTeX_ expression wrapped by a pair of ‘$$’ marks: +In the markdown source file, the math block is a LaTeX expression wrapped by a pair of ‘$$’ marks: ```md $$ @@ -208,7 +208,7 @@ This is [an example](http://example.com/) inline link. (`

This is @@ -60,7 +60,7 @@ yarn add feishu-pages -

名称

Description

Required

Default

+

Description

Required

Default

FEISHU_APP_ID

飞书应用 ID

YES

@@ -72,9 +72,9 @@ yarn add feishu-pages -## **Usage** +## Usage -### **创建飞书应用并开通权限** +### 创建飞书应用并开通权限 1. 请访问 [https://open.feishu.cn/app](https://open.feishu.cn/app) 创建一个新应用,并获得: - `App ID` @@ -93,13 +93,13 @@ yarn add feishu-pages 5. 在飞书 IM 中创建新群 `Feishu Pages`,将应用添加为该群机器人,知识库管理员在「知识空间设置」-> 「权限设置」->「添加管理员」中添加,把这个 `Feishu Pages` 群加成 管理员:。 - 否则会遇到 `permission denied: wiki space permission denied` 错误。 [ref](https://open.feishu.cn/document/server-docs/docs/wiki-v2/wiki-qa) -### **获取飞书知识库 space_id** +### 获取飞书知识库 space_id 我们需要配置 `FEISHU_SPACE_ID` 的环境变量,这个为飞书知识库的 `space_id`,你可以访问知识库设置界面,从 URL 中获取。 例如:`https://your-company.feishu.cn/wiki/settings/6992046856314306562` 这里面 `6992046856314306562` 为 `space_id`。 -### **环境变量配置** +### 环境变量配置 Feishu Pages 支持 `.env` 文件,如果执行的根目录有个 `.env` 文件,将会自动读取。 @@ -107,7 +107,7 @@ Feishu Pages 支持 `.env` 文件,如果执行的根目录有个 `.env` 文件 如需在 GitHub Actions 的 CI 流程里面使用,建议添加到 Secrets 中,再通过环境变量的方式获取。 -## **从知识库导出 Markdown 文档** +## 从知识库导出 Markdown 文档 ```bash cd your-project/ @@ -116,9 +116,9 @@ yarn feishu-pages 按上面默认的配置,最终会在 `./dist` 目录下生成 Markdown 文件以及导出的图片文件,如果你期望调整目录,可以自己设置 `OUTPUT_DIR` 环境变量。 -## **常见问题** +## 常见问题 -### **Rate Limit 相关错误** +### Rate Limit 相关错误 > Error: request trigger frequency limit @@ -167,6 +167,6 @@ yarn feishu-pages -## **License** +## License -MIT +MIT \ No newline at end of file