{"id":13484146,"url":"https://github.com/markdown-it/markdown-it-container","last_synced_at":"2025-05-14T20:08:59.161Z","repository":{"id":28550403,"uuid":"32067681","full_name":"markdown-it/markdown-it-container","owner":"markdown-it","description":"Fenced container plugin for markdown-it markdown parser","archived":false,"fork":false,"pushed_at":"2023-12-05T14:33:08.000Z","size":35,"stargazers_count":531,"open_issues_count":2,"forks_count":75,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-06T19:24:17.712Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markdown-it.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-03-12T09:11:48.000Z","updated_at":"2025-04-28T02:17:08.000Z","dependencies_parsed_at":"2024-01-13T03:27:34.916Z","dependency_job_id":"a8c2a676-546b-47a4-9377-7bd6c99f709c","html_url":"https://github.com/markdown-it/markdown-it-container","commit_stats":{"total_commits":24,"total_committers":4,"mean_commits":6.0,"dds":0.375,"last_synced_commit":"d1e8414bea1897173e38f0ba22e8907665d09b69"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markdown-it%2Fmarkdown-it-container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markdown-it%2Fmarkdown-it-container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markdown-it%2Fmarkdown-it-container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markdown-it%2Fmarkdown-it-container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markdown-it","download_url":"https://codeload.github.com/markdown-it/markdown-it-container/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253520605,"owners_count":21921374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T17:01:19.923Z","updated_at":"2025-05-14T20:08:59.124Z","avatar_url":"https://github.com/markdown-it.png","language":"JavaScript","readme":"# markdown-it-container\n\n[![CI](https://github.com/markdown-it/markdown-it-container/actions/workflows/ci.yml/badge.svg)](https://github.com/markdown-it/markdown-it-container/actions/workflows/ci.yml)\n[![NPM version](https://img.shields.io/npm/v/markdown-it-container.svg?style=flat)](https://www.npmjs.org/package/markdown-it-container)\n[![Coverage Status](https://img.shields.io/coveralls/markdown-it/markdown-it-container/master.svg?style=flat)](https://coveralls.io/r/markdown-it/markdown-it-container?branch=master)\n\n\u003e Plugin for creating block-level custom containers for [markdown-it](https://github.com/markdown-it/markdown-it) markdown parser.\n\n__v2.+ requires `markdown-it` v5.+, see changelog.__\n\nWith this plugin you can create block containers like:\n\n```\n::: warning\n*here be dragons*\n:::\n```\n\n.... and specify how they should be rendered. If no renderer defined, `\u003cdiv\u003e` with\ncontainer name class will be created:\n\n```html\n\u003cdiv class=\"warning\"\u003e\n\u003cem\u003ehere be dragons\u003c/em\u003e\n\u003c/div\u003e\n```\n\nMarkup is the same as for [fenced code blocks](http://spec.commonmark.org/0.18/#fenced-code-blocks).\nDifference is, that marker use another character and content is rendered as markdown markup.\n\n\n## Installation\n\nnode.js, browser:\n\n```bash\n$ npm install markdown-it-container --save\n$ bower install markdown-it-container --save\n```\n\n\n## API\n\n```js\nvar md = require('markdown-it')()\n            .use(require('markdown-it-container'), name [, options]);\n```\n\nParams:\n\n- __name__ - container name (mandatory)\n- __options:__\n   - __validate__ - optional, function to validate tail after opening marker, should\n     return `true` on success.\n   - __render__ - optional, renderer function for opening/closing tokens.\n   - __marker__ - optional (`:`), character to use in delimiter.\n\n\n## Example\n\n```js\nvar md = require('markdown-it')();\n\nmd.use(require('markdown-it-container'), 'spoiler', {\n\n  validate: function(params) {\n    return params.trim().match(/^spoiler\\s+(.*)$/);\n  },\n\n  render: function (tokens, idx) {\n    var m = tokens[idx].info.trim().match(/^spoiler\\s+(.*)$/);\n\n    if (tokens[idx].nesting === 1) {\n      // opening tag\n      return '\u003cdetails\u003e\u003csummary\u003e' + md.utils.escapeHtml(m[1]) + '\u003c/summary\u003e\\n';\n\n    } else {\n      // closing tag\n      return '\u003c/details\u003e\\n';\n    }\n  }\n});\n\nconsole.log(md.render('::: spoiler click me\\n*content*\\n:::\\n'));\n\n// Output:\n//\n// \u003cdetails\u003e\u003csummary\u003eclick me\u003c/summary\u003e\n// \u003cp\u003e\u003cem\u003econtent\u003c/em\u003e\u003c/p\u003e\n// \u003c/details\u003e\n```\n\n## License\n\n[MIT](https://github.com/markdown-it/markdown-it-container/blob/master/LICENSE)\n","funding_links":[],"categories":["JavaScript","🙌 Marp をもっと楽しむ 🙌"],"sub_categories":["Markdown 拡張構文の利用"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkdown-it%2Fmarkdown-it-container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkdown-it%2Fmarkdown-it-container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkdown-it%2Fmarkdown-it-container/lists"}