Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

turndown-plugin-gfm

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turndown-plugin-gfm

Turndown plugin to add GitHub Flavored Markdown extensions.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is turndown-plugin-gfm?

The turndown-plugin-gfm package is a plugin for Turndown, a library that converts HTML into Markdown. This plugin specifically adds support for GitHub Flavored Markdown (GFM) to Turndown, enabling the conversion of HTML elements that are unique to GFM.

What are turndown-plugin-gfm's main functionalities?

Strikethrough

This feature converts HTML <del> tags into GFM strikethrough syntax using double tildes (~~).

const TurndownService = require('turndown');
const gfm = require('turndown-plugin-gfm').gfm;

const turndownService = new TurndownService();
turndownService.use(gfm);

const html = '<p><del>Strikethrough text</del></p>';
const markdown = turndownService.turndown(html);
console.log(markdown); // Outputs: '~~Strikethrough text~~'

Tables

This feature converts HTML tables into GFM table syntax, which is a common requirement for documentation and README files.

const TurndownService = require('turndown');
const gfm = require('turndown-plugin-gfm').gfm;

const turndownService = new TurndownService();
turndownService.use(gfm);

const html = '<table><thead><tr><th>Header 1</th><th>Header 2</th></tr></thead><tbody><tr><td>Data 1</td><td>Data 2</td></tr></tbody></table>';
const markdown = turndownService.turndown(html);
console.log(markdown); // Outputs: '| Header 1 | Header 2 |
| --- | --- |
| Data 1 | Data 2 |'

Task Lists

This feature converts HTML checkboxes within list items into GFM task list syntax, which is useful for project management and to-do lists.

const TurndownService = require('turndown');
const gfm = require('turndown-plugin-gfm').gfm;

const turndownService = new TurndownService();
turndownService.use(gfm);

const html = '<ul><li><input type="checkbox" checked> Task 1</li><li><input type="checkbox"> Task 2</li></ul>';
const markdown = turndownService.turndown(html);
console.log(markdown); // Outputs: '- [x] Task 1
- [ ] Task 2'

Other packages similar to turndown-plugin-gfm

Keywords

FAQs

Package last updated on 11 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc