Initalize

This commit is contained in:
Your Name
2026-05-03 12:12:57 -04:00
commit 38652eb9b5
10603 changed files with 1762136 additions and 0 deletions

22
node_modules/markdown-it-container/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
Copyright (c) 2015 Vitaly Puzrin, Alex Kocharin.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

95
node_modules/markdown-it-container/README.md generated vendored Normal file
View File

@@ -0,0 +1,95 @@
# markdown-it-container
[![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)
[![NPM version](https://img.shields.io/npm/v/markdown-it-container.svg?style=flat)](https://www.npmjs.org/package/markdown-it-container)
[![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)
> Plugin for creating block-level custom containers for [markdown-it](https://github.com/markdown-it/markdown-it) markdown parser.
__v2.+ requires `markdown-it` v5.+, see changelog.__
With this plugin you can create block containers like:
```
::: warning
*here be dragons*
:::
```
.... and specify how they should be rendered. If no renderer defined, `<div>` with
container name class will be created:
```html
<div class="warning">
<em>here be dragons</em>
</div>
```
Markup is the same as for [fenced code blocks](http://spec.commonmark.org/0.18/#fenced-code-blocks).
Difference is, that marker use another character and content is rendered as markdown markup.
## Installation
node.js, browser:
```bash
$ npm install markdown-it-container --save
$ bower install markdown-it-container --save
```
## API
```js
var md = require('markdown-it')()
.use(require('markdown-it-container'), name [, options]);
```
Params:
- __name__ - container name (mandatory)
- __options:__
- __validate__ - optional, function to validate tail after opening marker, should
return `true` on success.
- __render__ - optional, renderer function for opening/closing tokens.
- __marker__ - optional (`:`), character to use in delimiter.
## Example
```js
var md = require('markdown-it')();
md.use(require('markdown-it-container'), 'spoiler', {
validate: function(params) {
return params.trim().match(/^spoiler\s+(.*)$/);
},
render: function (tokens, idx) {
var m = tokens[idx].info.trim().match(/^spoiler\s+(.*)$/);
if (tokens[idx].nesting === 1) {
// opening tag
return '<details><summary>' + md.utils.escapeHtml(m[1]) + '</summary>\n';
} else {
// closing tag
return '</details>\n';
}
}
});
console.log(md.render('::: spoiler click me\n*content*\n:::\n'));
// Output:
//
// <details><summary>click me</summary>
// <p><em>content</em></p>
// </details>
```
## License
[MIT](https://github.com/markdown-it/markdown-it-container/blob/master/LICENSE)

136
node_modules/markdown-it-container/dist/index.cjs.js generated vendored Normal file
View File

@@ -0,0 +1,136 @@
'use strict';
// Process block-level custom containers
//
function container_plugin(md, name, options) {
// Second param may be useful if you decide
// to increase minimal allowed marker length
function validateDefault(params /*, markup */) {
return params.trim().split(' ', 2)[0] === name;
}
function renderDefault(tokens, idx, _options, env, slf) {
// add a class to the opening tag
if (tokens[idx].nesting === 1) {
tokens[idx].attrJoin('class', name);
}
return slf.renderToken(tokens, idx, _options, env, slf);
}
options = options || {};
const min_markers = 3;
const marker_str = options.marker || ':';
const marker_char = marker_str.charCodeAt(0);
const marker_len = marker_str.length;
const validate = options.validate || validateDefault;
const render = options.render || renderDefault;
function container(state, startLine, endLine, silent) {
let pos;
let auto_closed = false;
let start = state.bMarks[startLine] + state.tShift[startLine];
let max = state.eMarks[startLine];
// Check out the first character quickly,
// this should filter out most of non-containers
//
if (marker_char !== state.src.charCodeAt(start)) {
return false;
}
// Check out the rest of the marker string
//
for (pos = start + 1; pos <= max; pos++) {
if (marker_str[(pos - start) % marker_len] !== state.src[pos]) {
break;
}
}
const marker_count = Math.floor((pos - start) / marker_len);
if (marker_count < min_markers) {
return false;
}
pos -= (pos - start) % marker_len;
const markup = state.src.slice(start, pos);
const params = state.src.slice(pos, max);
if (!validate(params, markup)) {
return false;
}
// Since start is found, we can report success here in validation mode
//
if (silent) {
return true;
}
// Search for the end of the block
//
let nextLine = startLine;
for (;;) {
nextLine++;
if (nextLine >= endLine) {
// unclosed block should be autoclosed by end of document.
// also block seems to be autoclosed by end of parent
break;
}
start = state.bMarks[nextLine] + state.tShift[nextLine];
max = state.eMarks[nextLine];
if (start < max && state.sCount[nextLine] < state.blkIndent) {
// non-empty line with negative indent should stop the list:
// - ```
// test
break;
}
if (marker_char !== state.src.charCodeAt(start)) {
continue;
}
if (state.sCount[nextLine] - state.blkIndent >= 4) {
// closing fence should be indented less than 4 spaces
continue;
}
for (pos = start + 1; pos <= max; pos++) {
if (marker_str[(pos - start) % marker_len] !== state.src[pos]) {
break;
}
}
// closing code fence must be at least as long as the opening one
if (Math.floor((pos - start) / marker_len) < marker_count) {
continue;
}
// make sure tail has spaces only
pos -= (pos - start) % marker_len;
pos = state.skipSpaces(pos);
if (pos < max) {
continue;
}
// found!
auto_closed = true;
break;
}
const old_parent = state.parentType;
const old_line_max = state.lineMax;
state.parentType = 'container';
// this will prevent lazy continuations from ever going past our end marker
state.lineMax = nextLine;
const token_o = state.push('container_' + name + '_open', 'div', 1);
token_o.markup = markup;
token_o.block = true;
token_o.info = params;
token_o.map = [startLine, nextLine];
state.md.block.tokenize(state, startLine + 1, nextLine);
const token_c = state.push('container_' + name + '_close', 'div', -1);
token_c.markup = state.src.slice(start, pos);
token_c.block = true;
state.parentType = old_parent;
state.lineMax = old_line_max;
state.line = nextLine + (auto_closed ? 1 : 0);
return true;
}
md.block.ruler.before('fence', 'container_' + name, container, {
alt: ['paragraph', 'reference', 'blockquote', 'list']
});
md.renderer.rules['container_' + name + '_open'] = render;
md.renderer.rules['container_' + name + '_close'] = render;
}
module.exports = container_plugin;

View File

@@ -0,0 +1,132 @@
/*! markdown-it-container 4.0.0 https://github.com/markdown-it/markdown-it-container @license MIT */
(function(global, factory) {
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,
global.markdownitContainer = factory());
})(this, (function() {
"use strict";
// Process block-level custom containers
function container_plugin(md, name, options) {
// Second param may be useful if you decide
// to increase minimal allowed marker length
function validateDefault(params /*, markup */) {
return params.trim().split(" ", 2)[0] === name;
}
function renderDefault(tokens, idx, _options, env, slf) {
// add a class to the opening tag
if (tokens[idx].nesting === 1) {
tokens[idx].attrJoin("class", name);
}
return slf.renderToken(tokens, idx, _options, env, slf);
}
options = options || {};
const min_markers = 3;
const marker_str = options.marker || ":";
const marker_char = marker_str.charCodeAt(0);
const marker_len = marker_str.length;
const validate = options.validate || validateDefault;
const render = options.render || renderDefault;
function container(state, startLine, endLine, silent) {
let pos;
let auto_closed = false;
let start = state.bMarks[startLine] + state.tShift[startLine];
let max = state.eMarks[startLine];
// Check out the first character quickly,
// this should filter out most of non-containers
if (marker_char !== state.src.charCodeAt(start)) {
return false;
}
// Check out the rest of the marker string
for (pos = start + 1; pos <= max; pos++) {
if (marker_str[(pos - start) % marker_len] !== state.src[pos]) {
break;
}
}
const marker_count = Math.floor((pos - start) / marker_len);
if (marker_count < min_markers) {
return false;
}
pos -= (pos - start) % marker_len;
const markup = state.src.slice(start, pos);
const params = state.src.slice(pos, max);
if (!validate(params, markup)) {
return false;
}
// Since start is found, we can report success here in validation mode
if (silent) {
return true;
}
// Search for the end of the block
let nextLine = startLine;
for (;;) {
nextLine++;
if (nextLine >= endLine) {
// unclosed block should be autoclosed by end of document.
// also block seems to be autoclosed by end of parent
break;
}
start = state.bMarks[nextLine] + state.tShift[nextLine];
max = state.eMarks[nextLine];
if (start < max && state.sCount[nextLine] < state.blkIndent) {
// non-empty line with negative indent should stop the list:
// - ```
// test
break;
}
if (marker_char !== state.src.charCodeAt(start)) {
continue;
}
if (state.sCount[nextLine] - state.blkIndent >= 4) {
// closing fence should be indented less than 4 spaces
continue;
}
for (pos = start + 1; pos <= max; pos++) {
if (marker_str[(pos - start) % marker_len] !== state.src[pos]) {
break;
}
}
// closing code fence must be at least as long as the opening one
if (Math.floor((pos - start) / marker_len) < marker_count) {
continue;
}
// make sure tail has spaces only
pos -= (pos - start) % marker_len;
pos = state.skipSpaces(pos);
if (pos < max) {
continue;
}
// found!
auto_closed = true;
break;
}
const old_parent = state.parentType;
const old_line_max = state.lineMax;
state.parentType = "container";
// this will prevent lazy continuations from ever going past our end marker
state.lineMax = nextLine;
const token_o = state.push("container_" + name + "_open", "div", 1);
token_o.markup = markup;
token_o.block = true;
token_o.info = params;
token_o.map = [ startLine, nextLine ];
state.md.block.tokenize(state, startLine + 1, nextLine);
const token_c = state.push("container_" + name + "_close", "div", -1);
token_c.markup = state.src.slice(start, pos);
token_c.block = true;
state.parentType = old_parent;
state.lineMax = old_line_max;
state.line = nextLine + (auto_closed ? 1 : 0);
return true;
}
md.block.ruler.before("fence", "container_" + name, container, {
alt: [ "paragraph", "reference", "blockquote", "list" ]
});
md.renderer.rules["container_" + name + "_open"] = render;
md.renderer.rules["container_" + name + "_close"] = render;
}
return container_plugin;
}));

View File

@@ -0,0 +1,2 @@
/*! markdown-it-container 4.0.0 https://github.com/markdown-it/markdown-it-container @license MIT */
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).markdownitContainer=n()}(this,(function(){"use strict";return function(e,n,r){const t=(r=r||{}).marker||":",o=t.charCodeAt(0),i=t.length,c=r.validate||function(e){return e.trim().split(" ",2)[0]===n},s=r.render||function(e,r,t,o,i){return 1===e[r].nesting&&e[r].attrJoin("class",n),i.renderToken(e,r,t,o,i)};e.block.ruler.before("fence","container_"+n,(function(e,r,s,a){let l,f=!1,u=e.bMarks[r]+e.tShift[r],d=e.eMarks[r];if(o!==e.src.charCodeAt(u))return!1;for(l=u+1;l<=d&&t[(l-u)%i]===e.src[l];l++);const p=Math.floor((l-u)/i);if(p<3)return!1;l-=(l-u)%i;const k=e.src.slice(u,l),b=e.src.slice(l,d);if(!c(b,k))return!1;if(a)return!0;let h=r;for(;(h++,!(h>=s))&&(u=e.bMarks[h]+e.tShift[h],d=e.eMarks[h],!(u<d&&e.sCount[h]<e.blkIndent));)if(o===e.src.charCodeAt(u)&&!(e.sCount[h]-e.blkIndent>=4)){for(l=u+1;l<=d&&t[(l-u)%i]===e.src[l];l++);if(!(Math.floor((l-u)/i)<p||(l-=(l-u)%i,l=e.skipSpaces(l),l<d))){f=!0;break}}const m=e.parentType,M=e.lineMax;e.parentType="container",e.lineMax=h;const _=e.push("container_"+n+"_open","div",1);_.markup=k,_.block=!0,_.info=b,_.map=[r,h],e.md.block.tokenize(e,r+1,h);const y=e.push("container_"+n+"_close","div",-1);return y.markup=e.src.slice(u,l),y.block=!0,e.parentType=m,e.lineMax=M,e.line=h+(f?1:0),!0}),{alt:["paragraph","reference","blockquote","list"]}),e.renderer.rules["container_"+n+"_open"]=s,e.renderer.rules["container_"+n+"_close"]=s}}));

139
node_modules/markdown-it-container/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,139 @@
// Process block-level custom containers
//
export default function container_plugin (md, name, options) {
// Second param may be useful if you decide
// to increase minimal allowed marker length
function validateDefault (params/*, markup */) {
return params.trim().split(' ', 2)[0] === name
}
function renderDefault (tokens, idx, _options, env, slf) {
// add a class to the opening tag
if (tokens[idx].nesting === 1) {
tokens[idx].attrJoin('class', name)
}
return slf.renderToken(tokens, idx, _options, env, slf)
}
options = options || {}
const min_markers = 3
const marker_str = options.marker || ':'
const marker_char = marker_str.charCodeAt(0)
const marker_len = marker_str.length
const validate = options.validate || validateDefault
const render = options.render || renderDefault
function container (state, startLine, endLine, silent) {
let pos
let auto_closed = false
let start = state.bMarks[startLine] + state.tShift[startLine]
let max = state.eMarks[startLine]
// Check out the first character quickly,
// this should filter out most of non-containers
//
if (marker_char !== state.src.charCodeAt(start)) { return false }
// Check out the rest of the marker string
//
for (pos = start + 1; pos <= max; pos++) {
if (marker_str[(pos - start) % marker_len] !== state.src[pos]) {
break
}
}
const marker_count = Math.floor((pos - start) / marker_len)
if (marker_count < min_markers) { return false }
pos -= (pos - start) % marker_len
const markup = state.src.slice(start, pos)
const params = state.src.slice(pos, max)
if (!validate(params, markup)) { return false }
// Since start is found, we can report success here in validation mode
//
if (silent) { return true }
// Search for the end of the block
//
let nextLine = startLine
for (;;) {
nextLine++
if (nextLine >= endLine) {
// unclosed block should be autoclosed by end of document.
// also block seems to be autoclosed by end of parent
break
}
start = state.bMarks[nextLine] + state.tShift[nextLine]
max = state.eMarks[nextLine]
if (start < max && state.sCount[nextLine] < state.blkIndent) {
// non-empty line with negative indent should stop the list:
// - ```
// test
break
}
if (marker_char !== state.src.charCodeAt(start)) { continue }
if (state.sCount[nextLine] - state.blkIndent >= 4) {
// closing fence should be indented less than 4 spaces
continue
}
for (pos = start + 1; pos <= max; pos++) {
if (marker_str[(pos - start) % marker_len] !== state.src[pos]) {
break
}
}
// closing code fence must be at least as long as the opening one
if (Math.floor((pos - start) / marker_len) < marker_count) { continue }
// make sure tail has spaces only
pos -= (pos - start) % marker_len
pos = state.skipSpaces(pos)
if (pos < max) { continue }
// found!
auto_closed = true
break
}
const old_parent = state.parentType
const old_line_max = state.lineMax
state.parentType = 'container'
// this will prevent lazy continuations from ever going past our end marker
state.lineMax = nextLine
const token_o = state.push('container_' + name + '_open', 'div', 1)
token_o.markup = markup
token_o.block = true
token_o.info = params
token_o.map = [startLine, nextLine]
state.md.block.tokenize(state, startLine + 1, nextLine)
const token_c = state.push('container_' + name + '_close', 'div', -1)
token_c.markup = state.src.slice(start, pos)
token_c.block = true
state.parentType = old_parent
state.lineMax = old_line_max
state.line = nextLine + (auto_closed ? 1 : 0)
return true
}
md.block.ruler.before('fence', 'container_' + name, container, {
alt: ['paragraph', 'reference', 'blockquote', 'list']
})
md.renderer.rules['container_' + name + '_open'] = render
md.renderer.rules['container_' + name + '_close'] = render
};

47
node_modules/markdown-it-container/package.json generated vendored Normal file
View File

@@ -0,0 +1,47 @@
{
"name": "markdown-it-container",
"version": "4.0.0",
"description": "Plugin to create block-level custom containers for markdown-it markdown parser",
"repository": "markdown-it/markdown-it-container",
"license": "MIT",
"keywords": [
"markdown-it-plugin",
"markdown-it",
"markdown"
],
"main": "dist/index.cjs.js",
"module": "index.mjs",
"exports": {
".": {
"require": "./dist/index.cjs.js",
"import": "./index.mjs"
},
"./*": {
"require": "./*",
"import": "./*"
}
},
"files": [
"index.mjs",
"lib/",
"dist/"
],
"scripts": {
"lint": "eslint .",
"build": "rollup -c",
"test": "npm run lint && npm run build && c8 --exclude dist --exclude test -r text -r html -r lcov mocha",
"prepublishOnly": "npm run lint && npm run build"
},
"devDependencies": {
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"c8": "^8.0.1",
"eslint": "^8.55.0",
"eslint-config-standard": "^17.1.0",
"markdown-it": "^13.0.2",
"markdown-it-testgen": "^0.1.6",
"mocha": "^10.2.0",
"rollup": "^4.6.1"
}
}