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

mdast-util-gfm-task-list-item

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-util-gfm-task-list-item

mdast extension to parse and serialize GFM task list items

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.1M
increased by10.08%
Maintainers
2
Weekly downloads
 
Created

What is mdast-util-gfm-task-list-item?

The `mdast-util-gfm-task-list-item` package is a utility for working with GitHub Flavored Markdown (GFM) task list items within the MDAST (Markdown Abstract Syntax Tree) ecosystem. It provides functionality to parse and transform task list items in Markdown documents.

What are mdast-util-gfm-task-list-item's main functionalities?

Parse GFM Task List Items

This feature allows you to parse GFM task list items from a Markdown string into an MDAST tree. The code sample demonstrates how to convert a Markdown string containing task list items into an MDAST tree.

const { fromMarkdown } = require('mdast-util-from-markdown');
const { gfmTaskListItemFromMarkdown } = require('mdast-util-gfm-task-list-item');

const markdown = '- [ ] Task 1\n- [x] Task 2';
const tree = fromMarkdown(markdown, { extensions: [gfmTaskListItemFromMarkdown()] });
console.log(JSON.stringify(tree, null, 2));

Serialize GFM Task List Items

This feature allows you to serialize an MDAST tree containing GFM task list items back into a Markdown string. The code sample demonstrates how to convert an MDAST tree with task list items into a Markdown string.

const { toMarkdown } = require('mdast-util-to-markdown');
const { gfmTaskListItemToMarkdown } = require('mdast-util-gfm-task-list-item');

const tree = {
  type: 'root',
  children: [
    { type: 'listItem', checked: null, children: [{ type: 'text', value: 'Task 1' }] },
    { type: 'listItem', checked: true, children: [{ type: 'text', value: 'Task 2' }] }
  ]
};
const markdown = toMarkdown(tree, { extensions: [gfmTaskListItemToMarkdown()] });
console.log(markdown);

Other packages similar to mdast-util-gfm-task-list-item

Keywords

FAQs

Package last updated on 10 Jul 2023

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