将字符串从API调用转换为Markdown语法?

发布于 2025-02-11 21:46:47 字数 291 浏览 0 评论 0原文

假设我有一个(GraphQL)API调用,该调用返回以下内容:

node {
   "body": "* Hello\r\n\r\n_World_",
}

* Hello

_World_

原始降价中。

(更具体地说,我正在获取GitHub发表评论。我知道GitHub API中的HTML有一个选择,但是我只是好奇。)

是否有任何简单的方法可以将其转变为JavaScript中的Markdown?没有正则。

Let's say I have a (graphQL) API call that returns the following:

node {
   "body": "* Hello\r\n\r\n_World_",
}

Which is

* Hello

_World_

in the original Markdown.

(To be more specific, I'm fetching github issues comments. I know there's an option for HTML in the github API, but I'm just curious.)

Is there any easy way to turn that back to Markdown in javascript? Without regex.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文