@guyplusplus/turndown-plugin-gfm

中文文档
1.0.7发布于 2021/07/03MITESM + CJS近 30 天下载 7.6万

Turndown plugin to add GitHub Flavored Markdown extensions.

原始使用文档
文档目录5 节
  1. Test Page
  2. Fork information
  3. Installation
  4. Usage
  5. License

turndown-plugin-gfm

A Turndown plugin which adds GitHub Flavored Markdown extensions.

Test Page

The test page can be found here.

Fork information

This is a fork of the original turndown-plugin-gfm for general purpose. It is pending on this pull request.

The changes are:

  • migrated to node v5
  • upgraded inclusion of turndown npm package to 7.0.0
  • support tables with caption and colgroup elements
  • support conversion of a multi-lines cell to a single line cell
  • pipe character | are properly escaped in a table cell
  • fix support for tables with no row
  • support for colspan
  • nested table inside a table render as is, gfm is not applied
  • added more test cases accordingly

TODO:

  • rowspan support
  • support for relaxed and strict gfm (not html) rendering. So new lines, nested tables would render differently

Installation

npm:

npm install @guyplusplus/turndown-plugin-gfm

Browser:

<script src="https://unpkg.com/turndown/dist/turndown.js"></script>
<script src="https://unpkg.com/@guyplusplus/turndown-plugin-gfm/dist/turndown-plugin-gfm.js"></script>

Usage

// For Node.js
var TurndownService = require('turndown')
var TurndownPluginGfm = require('@guyplusplus/turndown-plugin-gfm')

var turndownService = new TurndownService()
TurndownPluginGfm.gfm(turndownService)
var markdown = turndownService.turndown('<strike>Hello world!</strike>')

turndown-plugin-gfm is a suite of plugins which can be applied individually. The available plugins are as follows:

  • strikethrough (for converting <strike>, <s>, and <del> elements)
  • tables
  • taskListItems
  • gfm (which applies all of the above)

So for example, if you only wish to convert tables:

var tables = require('turndown-plugin-gfm').tables
var turndownService = new TurndownService()
turndownService.use(tables)

License

turndown-plugin-gfm is copyright © 2017+ Dom Christie and released under the MIT license.

版本与发布记录

@guyplusplus/turndown-plugin-gfm 共发布 4 个版本,首次发布于 2021/06/21;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.7latest2021/07/035 年前
1.0.62021/06/225 年前
1.0.52021/06/215 年前
1.0.42021/06/205 年前

关于 @guyplusplus/turndown-plugin-gfm 的常见问题

@guyplusplus/turndown-plugin-gfm 是什么?

Turndown plugin to add GitHub Flavored Markdown extensions.

如何安装 @guyplusplus/turndown-plugin-gfm?

在项目目录运行 npm install @guyplusplus/turndown-plugin-gfm,或使用 pnpm add / yarn add / bun add。

@guyplusplus/turndown-plugin-gfm 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/guyplusplus__turndown-plugin-gfm 是否存在。

@guyplusplus/turndown-plugin-gfm 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@guyplusplus/turndown-plugin-gfm 可以商用吗?

@guyplusplus/turndown-plugin-gfm 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@guyplusplus/turndown-plugin-gfm 的下载量有多少?

根据 npm 官方下载统计,@guyplusplus/turndown-plugin-gfm 在 2026/10/17 – 2026/11/15 这 30 天内被下载 75,862 次,日均约 2,529 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@guyplusplus/turndown-plugin-gfm 还在维护吗?

最新版本 1.0.7 发布于 2021/07/03(5 年前);至今共发布 4 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/06/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。