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

@types/marked

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/marked

TypeScript definitions for Marked

  • 0.6.0
  • npm
  • Socket score

Version published
Weekly downloads
518K
decreased by-29.72%
Maintainers
1
Weekly downloads
 
Created

What is @types/marked?

@types/marked provides TypeScript type definitions for the 'marked' library, which is a fast, lightweight markdown parser and compiler. It allows developers to use 'marked' with TypeScript, ensuring type safety and better development experience.

What are @types/marked's main functionalities?

Basic Markdown Parsing

This feature allows you to convert a markdown string into HTML. The code sample demonstrates how to use 'marked' to parse a simple markdown string and convert it to HTML.

const marked = require('marked');
const markdownString = '# Hello World';
const htmlString = marked(markdownString);
console.log(htmlString);

Custom Renderer

This feature allows you to customize the rendering of markdown elements. The code sample shows how to create a custom renderer that changes the color of headings to red.

const marked = require('marked');
const renderer = new marked.Renderer();
renderer.heading = function (text, level) {
  return `<h${level} style="color: red;">${text}</h${level}>`;
};
const markdownString = '# Hello World';
const htmlString = marked(markdownString, { renderer: renderer });
console.log(htmlString);

Synchronous and Asynchronous Parsing

This feature allows you to parse markdown both synchronously and asynchronously. The code sample demonstrates both methods of parsing a markdown string.

const marked = require('marked');
const markdownString = '# Hello World';
// Synchronous
const htmlStringSync = marked(markdownString);
console.log(htmlStringSync);
// Asynchronous
marked(markdownString, (err, htmlStringAsync) => {
  if (err) throw err;
  console.log(htmlStringAsync);
});

Other packages similar to @types/marked

FAQs

Package last updated on 02 Jan 2019

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