JSPM

markdown-it-codetabs

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 335
  • Score
    100M100P100Q93738F
  • License MIT

Show your code blocks in different tabs.

Package Exports

  • markdown-it-codetabs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (markdown-it-codetabs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

markdown-it-codetabs

Code tabs plugin for markdown-it markdown parser.

Install

npm install markdown-it-codetabs --save

Use

var md = require('markdown-it')()
            .use(require('markdown-it-codetabs'));

md.render(markdownContent);
// Continuous code block with the same
// group markder (`[marker]`) will rendered to a tab.

Example

  1. Normal code block:

     ```python
     print("hello")
     ```
    
     ```js
     console.log("hello");
     ```
  2. Rendered to one block with two tabs (the tab name is language name):

     ```python []
     print("hello")
     ```
    
     ```js []
     console.log("hello");
     ```
  3. Rendered to two blocks with one tab separately (the content in square brackets doesn't matter as long as they are different):

     ```python [1]
     print("hello")
     ```
    
     ```js [2]
     console.log("hello");
     ```