{"size": 1126, "ext": "js", "max_stars_repo_path": "docs/build/md-plugin-containers.js", "max_stars_repo_name": "ygyg70/quasar", "max_stars_repo_stars_event_min_datetime": "2016-10-30T16:41:35.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T23:52:03.000Z", "max_issues_repo_path": "docs/build/md-plugin-containers.js", "max_issues_repo_name": "AaronWashington/quasar", "max_issues_repo_issues_event_min_datetime": "2016-10-31T02:49:31.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T21:30:34.000Z", "max_forks_repo_path": "docs/build/md-plugin-containers.js", "max_forks_repo_name": "AaronWashington/quasar", "max_forks_repo_forks_event_min_datetime": "2016-11-04T13:40:00.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-31T09:17:34.000Z"}
{"max_stars_count": 24951, "max_issues_count": 8086, "max_forks_count": 3675, "avg_line_length": 19.7543859649, "max_line_length": 120, "alphanum_fraction": 0.5364120782}
/**
 * Adds custom markdown containers
 *
 * ::: tip
 * My tip...
 * :::
 *
 * ::: warning
 * My warning
 * :::
 *
 * ::: danger
 * My dangerous message
 * :::
 *
 * Custom title:
 *
 * ::: warning WATCH OUT
 * My description
 * :::
 */

const container = require('markdown-it-container')

function createContainer (className, defaultTitle) {
  return [
    container,
    className,
    {
      render (tokens, idx) {
        const token = tokens[idx]
        const info = token.info.trim().slice(className.length).trim()
        if (token.nesting === 1) {
          return `<div class="doc-note doc-note--${className}"><p class="doc-note__title">${info || defaultTitle}</p>\n`
        }
        else {
          return `</div>\n`
        }
      }
    }
  ]
}

module.exports = function (md) {
  md
    .use(...createContainer('tip', 'TIP'))
    .use(...createContainer('warning', 'WARNING'))
    .use(...createContainer('danger', 'WARNING'))

    // explicitly escape Vue syntax
    .use(container, 'v-pre', {
      render: (tokens, idx) => tokens[idx].nesting === 1
        ? `<div v-pre>\n`
        : `</div>\n`
    })
}
