first commit

This commit is contained in:
2026-06-02 10:42:33 +08:00
commit dd4975fd2c
1084 changed files with 442416 additions and 0 deletions

20
node_modules/snarkdown/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2017 Jason Miller
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.

53
node_modules/snarkdown/README.md generated vendored Normal file
View File

@@ -0,0 +1,53 @@
<p align="center">
<img src="https://cdn.jsdelivr.net/emojione/assets/svg/1f63c.svg" width="256" height="256" alt="Snarkdown">
</p>
<h1 align="center">
Snarkdown
<a href="https://www.npmjs.org/package/snarkdown">
<img src="https://img.shields.io/npm/v/snarkdown.svg?style=flat" alt="npm">
</a>
</h1>
Snarkdown is a dead simple **1kb** [Markdown] parser.
It's designed to be as minimal as possible, for constrained use-cases where a full Markdown parser would be inappropriate.
## Features
- **Fast:** since it's basically one regex and a huge if statement
- **Tiny:** it's 1kb of gzipped ES3
- **Simple:** pass a Markdown string, get back an HTML string
> **Note:** Tables are not yet supported. If you love impossible to read regular expressions, submit a PR!
>
> **Note on XSS:** Snarkdown [doesn't sanitize HTML](https://github.com/developit/snarkdown/issues/70), since its primary target usage doesn't require it.
## Demos & Examples
- ⚛️ [**Snarky**](https://snarky.surge.sh) - markdown editor built with Preact & Snarkdown
- ✏️ [**Simple Markdown Editor**](http://jsfiddle.net/developit/828w6t1x/)
## Usage
Snarkdown exports a single function, which parses a string of Markdown and returns a String of HTML. Couldn't be simpler.
The snarkdown module is available in [every module format](https://unpkg.com/snarkdown/dist/) you'd ever need: ES Modules, CommonJS, UMD...
```js
import snarkdown from 'snarkdown';
let md = '_this_ is **easy** to `use`.';
let html = snarkdown(md);
console.log(html);
// <em>this</em> is <strong>easy</strong> to <code>use</code>.
```
### Add-ons and Libraries
- For Webpack users, [`snarkdown-loader`](https://github.com/Plugin-contrib/snarkdown-loader) renders markdown files to html.
[Markdown]: http://daringfireball.net/projects/markdown/

2
node_modules/snarkdown/dist/snarkdown.es.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
var e={"":["<em>","</em>"],_:["<strong>","</strong>"],"*":["<strong>","</strong>"],"~":["<s>","</s>"],"\n":["<br />"]," ":["<br />"],"-":["<hr />"]};function n(e){return e.replace(RegExp("^"+(e.match(/^(\t| )+/)||"")[0],"gm"),"")}function r(e){return(e+"").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}export default function t(a,c){var o,l,g,s,p,u=/((?:^|\n+)(?:\n---+|\* \*(?: \*)+)\n)|(?:^``` *(\w*)\n([\s\S]*?)\n```$)|((?:(?:^|\n+)(?:\t| {2,}).+)+\n*)|((?:(?:^|\n)([>*+-]|\d+\.)\s+.*)+)|(?:!\[([^\]]*?)\]\(([^)]+?)\))|(\[)|(\](?:\(([^)]+?)\))?)|(?:(?:^|\n+)([^\s].*)\n(-{3,}|={3,})(?:\n+|$))|(?:(?:^|\n+)(#{1,6})\s*(.+)(?:\n+|$))|(?:`([^`].*?)`)|( \n\n*|\n{2,}|__|\*\*|[_*]|~~)/gm,m=[],h="",i=c||{},d=0;function f(n){var r=e[n[1]||""],t=m[m.length-1]==n;return r?r[1]?(t?m.pop():m.push(n),r[0|t]):r[0]:n}function $(){for(var e="";m.length;)e+=f(m[m.length-1]);return e}for(a=a.replace(/^\[(.+?)\]:\s*(.+)$/gm,function(e,n,r){return i[n.toLowerCase()]=r,""}).replace(/^\n+|\n+$/g,"");g=u.exec(a);)l=a.substring(d,g.index),d=u.lastIndex,o=g[0],l.match(/[^\\](\\\\)*\\$/)||((p=g[3]||g[4])?o='<pre class="code '+(g[4]?"poetry":g[2].toLowerCase())+'"><code'+(g[2]?' class="language-'+g[2].toLowerCase()+'"':"")+">"+n(r(p).replace(/^\n+|\n+$/g,""))+"</code></pre>":(p=g[6])?(p.match(/\./)&&(g[5]=g[5].replace(/^\d+/gm,"")),s=t(n(g[5].replace(/^\s*[>*+.-]/gm,""))),">"==p?p="blockquote":(p=p.match(/\./)?"ol":"ul",s=s.replace(/^(.*)(\n|$)/gm,"<li>$1</li>")),o="<"+p+">"+s+"</"+p+">"):g[8]?o='<img src="'+r(g[8])+'" alt="'+r(g[7])+'">':g[10]?(h=h.replace("<a>",'<a href="'+r(g[11]||i[l.toLowerCase()])+'">'),o=$()+"</a>"):g[9]?o="<a>":g[12]||g[14]?o="<"+(p="h"+(g[14]?g[14].length:g[13]>"="?1:2))+">"+t(g[12]||g[15],i)+"</"+p+">":g[16]?o="<code>"+r(g[16])+"</code>":(g[17]||g[1])&&(o=f(g[17]||"--"))),h+=l,h+=o;return(h+a.substring(d)+$()).replace(/^\n+|\n+$/g,"")}
//# sourceMappingURL=snarkdown.es.js.map

1
node_modules/snarkdown/dist/snarkdown.es.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/snarkdown/dist/snarkdown.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
var e={"":["<em>","</em>"],_:["<strong>","</strong>"],"*":["<strong>","</strong>"],"~":["<s>","</s>"],"\n":["<br />"]," ":["<br />"],"-":["<hr />"]};function n(e){return e.replace(RegExp("^"+(e.match(/^(\t| )+/)||"")[0],"gm"),"")}function r(e){return(e+"").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}module.exports=function t(a,o){var c,l,s,g,p,u=/((?:^|\n+)(?:\n---+|\* \*(?: \*)+)\n)|(?:^``` *(\w*)\n([\s\S]*?)\n```$)|((?:(?:^|\n+)(?:\t| {2,}).+)+\n*)|((?:(?:^|\n)([>*+-]|\d+\.)\s+.*)+)|(?:!\[([^\]]*?)\]\(([^)]+?)\))|(\[)|(\](?:\(([^)]+?)\))?)|(?:(?:^|\n+)([^\s].*)\n(-{3,}|={3,})(?:\n+|$))|(?:(?:^|\n+)(#{1,6})\s*(.+)(?:\n+|$))|(?:`([^`].*?)`)|( \n\n*|\n{2,}|__|\*\*|[_*]|~~)/gm,m=[],h="",i=o||{},d=0;function $(n){var r=e[n[1]||""],t=m[m.length-1]==n;return r?r[1]?(t?m.pop():m.push(n),r[0|t]):r[0]:n}function f(){for(var e="";m.length;)e+=$(m[m.length-1]);return e}for(a=a.replace(/^\[(.+?)\]:\s*(.+)$/gm,function(e,n,r){return i[n.toLowerCase()]=r,""}).replace(/^\n+|\n+$/g,"");s=u.exec(a);)l=a.substring(d,s.index),d=u.lastIndex,c=s[0],l.match(/[^\\](\\\\)*\\$/)||((p=s[3]||s[4])?c='<pre class="code '+(s[4]?"poetry":s[2].toLowerCase())+'"><code'+(s[2]?' class="language-'+s[2].toLowerCase()+'"':"")+">"+n(r(p).replace(/^\n+|\n+$/g,""))+"</code></pre>":(p=s[6])?(p.match(/\./)&&(s[5]=s[5].replace(/^\d+/gm,"")),g=t(n(s[5].replace(/^\s*[>*+.-]/gm,""))),">"==p?p="blockquote":(p=p.match(/\./)?"ol":"ul",g=g.replace(/^(.*)(\n|$)/gm,"<li>$1</li>")),c="<"+p+">"+g+"</"+p+">"):s[8]?c='<img src="'+r(s[8])+'" alt="'+r(s[7])+'">':s[10]?(h=h.replace("<a>",'<a href="'+r(s[11]||i[l.toLowerCase()])+'">'),c=f()+"</a>"):s[9]?c="<a>":s[12]||s[14]?c="<"+(p="h"+(s[14]?s[14].length:s[13]>"="?1:2))+">"+t(s[12]||s[15],i)+"</"+p+">":s[16]?c="<code>"+r(s[16])+"</code>":(s[17]||s[1])&&(c=$(s[17]||"--"))),h+=l,h+=c;return(h+a.substring(d)+f()).replace(/^\n+|\n+$/g,"")};
//# sourceMappingURL=snarkdown.js.map

1
node_modules/snarkdown/dist/snarkdown.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/snarkdown/dist/snarkdown.modern.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
const e={"":["<em>","</em>"],_:["<strong>","</strong>"],"*":["<strong>","</strong>"],"~":["<s>","</s>"],"\n":["<br />"]," ":["<br />"],"-":["<hr />"]};function n(e){return e.replace(RegExp("^"+(e.match(/^(\t| )+/)||"")[0],"gm"),"")}function r(e){return(e+"").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}export default function t(c,o){let a,l,s,g,p,u=/((?:^|\n+)(?:\n---+|\* \*(?: \*)+)\n)|(?:^``` *(\w*)\n([\s\S]*?)\n```$)|((?:(?:^|\n+)(?:\t| {2,}).+)+\n*)|((?:(?:^|\n)([>*+-]|\d+\.)\s+.*)+)|(?:!\[([^\]]*?)\]\(([^)]+?)\))|(\[)|(\](?:\(([^)]+?)\))?)|(?:(?:^|\n+)([^\s].*)\n(-{3,}|={3,})(?:\n+|$))|(?:(?:^|\n+)(#{1,6})\s*(.+)(?:\n+|$))|(?:`([^`].*?)`)|( \n\n*|\n{2,}|__|\*\*|[_*]|~~)/gm,$=[],m="",h=o||{},i=0;function d(n){let r=e[n[1]||""],t=$[$.length-1]==n;return r?r[1]?(t?$.pop():$.push(n),r[0|t]):r[0]:n}function f(){let e="";for(;$.length;)e+=d($[$.length-1]);return e}for(c=c.replace(/^\[(.+?)\]:\s*(.+)$/gm,(e,n,r)=>(h[n.toLowerCase()]=r,"")).replace(/^\n+|\n+$/g,"");s=u.exec(c);)l=c.substring(i,s.index),i=u.lastIndex,a=s[0],l.match(/[^\\](\\\\)*\\$/)||((p=s[3]||s[4])?a='<pre class="code '+(s[4]?"poetry":s[2].toLowerCase())+'"><code'+(s[2]?` class="language-${s[2].toLowerCase()}"`:"")+">"+n(r(p).replace(/^\n+|\n+$/g,""))+"</code></pre>":(p=s[6])?(p.match(/\./)&&(s[5]=s[5].replace(/^\d+/gm,"")),g=t(n(s[5].replace(/^\s*[>*+.-]/gm,""))),">"==p?p="blockquote":(p=p.match(/\./)?"ol":"ul",g=g.replace(/^(.*)(\n|$)/gm,"<li>$1</li>")),a="<"+p+">"+g+"</"+p+">"):s[8]?a=`<img src="${r(s[8])}" alt="${r(s[7])}">`:s[10]?(m=m.replace("<a>",`<a href="${r(s[11]||h[l.toLowerCase()])}">`),a=f()+"</a>"):s[9]?a="<a>":s[12]||s[14]?(p="h"+(s[14]?s[14].length:s[13]>"="?1:2),a="<"+p+">"+t(s[12]||s[15],h)+"</"+p+">"):s[16]?a="<code>"+r(s[16])+"</code>":(s[17]||s[1])&&(a=d(s[17]||"--"))),m+=l,m+=a;return(m+c.substring(i)+f()).replace(/^\n+|\n+$/g,"")}
//# sourceMappingURL=snarkdown.modern.js.map

1
node_modules/snarkdown/dist/snarkdown.modern.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/snarkdown/dist/snarkdown.umd.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).snarkdown=n()}(this,function(){var e={"":["<em>","</em>"],_:["<strong>","</strong>"],"*":["<strong>","</strong>"],"~":["<s>","</s>"],"\n":["<br />"]," ":["<br />"],"-":["<hr />"]};function n(e){return e.replace(RegExp("^"+(e.match(/^(\t| )+/)||"")[0],"gm"),"")}function r(e){return(e+"").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}return function t(o,a){var c,s,l,g,u,p=/((?:^|\n+)(?:\n---+|\* \*(?: \*)+)\n)|(?:^``` *(\w*)\n([\s\S]*?)\n```$)|((?:(?:^|\n+)(?:\t| {2,}).+)+\n*)|((?:(?:^|\n)([>*+-]|\d+\.)\s+.*)+)|(?:!\[([^\]]*?)\]\(([^)]+?)\))|(\[)|(\](?:\(([^)]+?)\))?)|(?:(?:^|\n+)([^\s].*)\n(-{3,}|={3,})(?:\n+|$))|(?:(?:^|\n+)(#{1,6})\s*(.+)(?:\n+|$))|(?:`([^`].*?)`)|( \n\n*|\n{2,}|__|\*\*|[_*]|~~)/gm,f=[],i="",d=a||{},m=0;function h(n){var r=e[n[1]||""],t=f[f.length-1]==n;return r?r[1]?(t?f.pop():f.push(n),r[0|t]):r[0]:n}function $(){for(var e="";f.length;)e+=h(f[f.length-1]);return e}for(o=o.replace(/^\[(.+?)\]:\s*(.+)$/gm,function(e,n,r){return d[n.toLowerCase()]=r,""}).replace(/^\n+|\n+$/g,"");l=p.exec(o);)s=o.substring(m,l.index),m=p.lastIndex,c=l[0],s.match(/[^\\](\\\\)*\\$/)||((u=l[3]||l[4])?c='<pre class="code '+(l[4]?"poetry":l[2].toLowerCase())+'"><code'+(l[2]?' class="language-'+l[2].toLowerCase()+'"':"")+">"+n(r(u).replace(/^\n+|\n+$/g,""))+"</code></pre>":(u=l[6])?(u.match(/\./)&&(l[5]=l[5].replace(/^\d+/gm,"")),g=t(n(l[5].replace(/^\s*[>*+.-]/gm,""))),">"==u?u="blockquote":(u=u.match(/\./)?"ol":"ul",g=g.replace(/^(.*)(\n|$)/gm,"<li>$1</li>")),c="<"+u+">"+g+"</"+u+">"):l[8]?c='<img src="'+r(l[8])+'" alt="'+r(l[7])+'">':l[10]?(i=i.replace("<a>",'<a href="'+r(l[11]||d[s.toLowerCase()])+'">'),c=$()+"</a>"):l[9]?c="<a>":l[12]||l[14]?c="<"+(u="h"+(l[14]?l[14].length:l[13]>"="?1:2))+">"+t(l[12]||l[15],d)+"</"+u+">":l[16]?c="<code>"+r(l[16])+"</code>":(l[17]||l[1])&&(c=h(l[17]||"--"))),i+=s,i+=c;return(i+o.substring(m)+$()).replace(/^\n+|\n+$/g,"")}});
//# sourceMappingURL=snarkdown.umd.js.map

1
node_modules/snarkdown/dist/snarkdown.umd.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

73
node_modules/snarkdown/package.json generated vendored Normal file
View File

@@ -0,0 +1,73 @@
{
"name": "snarkdown",
"description": "Transform Markdown into HTML.",
"version": "2.0.0",
"main": "./dist/snarkdown.js",
"module": "./dist/snarkdown.es.js",
"modern": "./dist/snarkdown.modern.js",
"umd:main": "./dist/snarkdown.umd.js",
"unpkg": "./dist/snarkdown.umd.js",
"types": "./snarkdown.d.ts",
"scripts": {
"build": "microbundle",
"dev": "microbundle watch",
"test": "eslint src test && NODE_ENV=test mocha --compilers @babel/register",
"prepublish": "npm run -s build",
"release": "npm run -s build && npm test && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"
},
"authors": [
"Jason Miller <jason@developit.ca>"
],
"files": [
"src",
"dist",
"snarkdown.d.ts"
],
"homepage": "https://github.com/developit/snarkdown",
"repository": "developit/snarkdown",
"license": "MIT",
"keywords": [
"markdown",
"gfm",
"md",
"html",
"parser"
],
"devDependencies": {
"@babel/preset-env": "^7.11.5",
"@babel/register": "^7.11.5",
"chai": "^3.5.0",
"eslint": "^7.7.0",
"eslint-config-developit": "^1.2.0",
"microbundle": "^0.12.0",
"mocha": "^5.1.1",
"npm-merge-driver-install": "^1.1.1"
},
"eslintConfig": {
"extends": "developit",
"env": {
"browser": true,
"mocha": true,
"node": true,
"es6": true
},
"globals": {
"expect": true
},
"rules": {
"jest/valid-expect": 0,
"no-console": 1,
"no-cond-assign": 0,
"no-regex-spaces": 0
}
},
"babel": {
"env": {
"test": {
"presets": [
"@babel/preset-env"
]
}
}
}
}

6
node_modules/snarkdown/snarkdown.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
declare module "snarkdown" {
interface Links {
[index: string]: string;
}
export default function (urlStr: string, prevLinks?: Links): string;
}

109
node_modules/snarkdown/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,109 @@
const TAGS = {
'': ['<em>','</em>'],
_: ['<strong>','</strong>'],
'*': ['<strong>','</strong>'],
'~': ['<s>','</s>'],
'\n': ['<br />'],
' ': ['<br />'],
'-': ['<hr />']
};
/** Outdent a string based on the first indented line's leading whitespace
* @private
*/
function outdent(str) {
return str.replace(RegExp('^'+(str.match(/^(\t| )+/) || '')[0], 'gm'), '');
}
/** Encode special attribute characters to HTML entities in a String.
* @private
*/
function encodeAttr(str) {
return (str+'').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
/** Parse Markdown into an HTML String. */
export default function parse(md, prevLinks) {
let tokenizer = /((?:^|\n+)(?:\n---+|\* \*(?: \*)+)\n)|(?:^``` *(\w*)\n([\s\S]*?)\n```$)|((?:(?:^|\n+)(?:\t| {2,}).+)+\n*)|((?:(?:^|\n)([>*+-]|\d+\.)\s+.*)+)|(?:!\[([^\]]*?)\]\(([^)]+?)\))|(\[)|(\](?:\(([^)]+?)\))?)|(?:(?:^|\n+)([^\s].*)\n(-{3,}|={3,})(?:\n+|$))|(?:(?:^|\n+)(#{1,6})\s*(.+)(?:\n+|$))|(?:`([^`].*?)`)|( \n\n*|\n{2,}|__|\*\*|[_*]|~~)/gm,
context = [],
out = '',
links = prevLinks || {},
last = 0,
chunk, prev, token, inner, t;
function tag(token) {
let desc = TAGS[token[1] || ''];
let end = context[context.length-1] == token;
if (!desc) return token;
if (!desc[1]) return desc[0];
if (end) context.pop();
else context.push(token);
return desc[end|0];
}
function flush() {
let str = '';
while (context.length) str += tag(context[context.length-1]);
return str;
}
md = md.replace(/^\[(.+?)\]:\s*(.+)$/gm, (s, name, url) => {
links[name.toLowerCase()] = url;
return '';
}).replace(/^\n+|\n+$/g, '');
while ( (token=tokenizer.exec(md)) ) {
prev = md.substring(last, token.index);
last = tokenizer.lastIndex;
chunk = token[0];
if (prev.match(/[^\\](\\\\)*\\$/)) {
// escaped
}
// Code/Indent blocks:
else if (t = (token[3] || token[4])) {
chunk = '<pre class="code '+(token[4]?'poetry':token[2].toLowerCase())+'"><code'+(token[2] ? ` class="language-${token[2].toLowerCase()}"` : '')+'>'+outdent(encodeAttr(t).replace(/^\n+|\n+$/g, ''))+'</code></pre>';
}
// > Quotes, -* lists:
else if (t = token[6]) {
if (t.match(/\./)) {
token[5] = token[5].replace(/^\d+/gm, '');
}
inner = parse(outdent(token[5].replace(/^\s*[>*+.-]/gm, '')));
if (t=='>') t = 'blockquote';
else {
t = t.match(/\./) ? 'ol' : 'ul';
inner = inner.replace(/^(.*)(\n|$)/gm, '<li>$1</li>');
}
chunk = '<'+t+'>' + inner + '</'+t+'>';
}
// Images:
else if (token[8]) {
chunk = `<img src="${encodeAttr(token[8])}" alt="${encodeAttr(token[7])}">`;
}
// Links:
else if (token[10]) {
out = out.replace('<a>', `<a href="${encodeAttr(token[11] || links[prev.toLowerCase()])}">`);
chunk = flush() + '</a>';
}
else if (token[9]) {
chunk = '<a>';
}
// Headings:
else if (token[12] || token[14]) {
t = 'h' + (token[14] ? token[14].length : (token[13]>'=' ? 1 : 2));
chunk = '<'+t+'>' + parse(token[12] || token[15], links) + '</'+t+'>';
}
// `code`:
else if (token[16]) {
chunk = '<code>'+encodeAttr(token[16])+'</code>';
}
// Inline formatting: *em*, **strong** & friends
else if (token[17] || token[1]) {
chunk = tag(token[17] || '--');
}
out += prev;
out += chunk;
}
return (out + md.substring(last) + flush()).replace(/^\n+|\n+$/g, '');
}