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

markdown-it-container

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-it-container

Plugin to create block-level custom containers for markdown-it markdown parser

  • 4.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is markdown-it-container?

The markdown-it-container package is a plugin for the markdown-it Markdown parser that allows you to create custom containers in your Markdown content. These containers can be used to add custom styling, notes, warnings, or any other block-level content that you want to differentiate from the rest of your Markdown content.

What are markdown-it-container's main functionalities?

Custom Containers

This feature allows you to define custom containers in your Markdown content. In this example, a 'warning' container is created, which can be used to highlight warning messages.

```javascript
const md = require('markdown-it')();
const container = require('markdown-it-container');

md.use(container, 'warning');

const result = md.render(`
::: warning
*Warning*: This is a custom warning container.
:::
`);
console.log(result);
```

Custom Rendering

This feature allows you to customize the rendering of the containers. In this example, a 'note' container is created with custom rendering logic to include additional HTML structure and styling.

```javascript
const md = require('markdown-it')();
const container = require('markdown-it-container');

md.use(container, 'note', {
  render: function (tokens, idx) {
    var m = tokens[idx].info.trim().match(/^note\s+(.*)$/);
    if (tokens[idx].nesting === 1) {
      return '<div class="note">' + md.utils.escapeHtml(m[1]) + '\n';
    } else {
      return '</div>\n';
    }
  }
});

const result = md.render(`
::: note This is a custom note
*Note*: This is a custom note container.
:::
`);
console.log(result);
```

Other packages similar to markdown-it-container

Keywords

FAQs

Package last updated on 05 Dec 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