升级queue为task

This commit is contained in:
undefined committed 2020-05-08 12:02:19 +08:00
1 parent e7ce8c1f02
commit 5d7f57334f
14 files changed
+145 -130

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
{
"name": "html2md",
"version": "0.0.1",
"description": "Convert html to markdown"
}
+16
View File
@@ -0,0 +1,16 @@
global.Hydro.lib.html2md = module.exports = function html2md(str) {
return str.replace(/<p>/gmi, '').replace(/<\/p>/gmi, ' ')
.replace(/<h1>/gmi, '# ')
.replace(/<h2>/gmi, '## ')
.replace(/<h3>/gmi, '### ')
.replace(/<h4>/gmi, '#### ')
.replace(/<h5>/gmi, '##### ')
.replace(/<h6>/gmi, '###### ')
.replace(/<\/?code>/, '\n```\n')
.replace(/<img.*?src=".*?".*?>.*?<\/img>/gmi, (substr) => {
const RE_IMG = /<img.*?src="(.*?)".*?>(.*?)<\/img>/i;
const res = RE_IMG.exec(substr);
return `[${res[2]}](${res[1]})`;
})
.replace(/<\/h[0-6]>/, '\n');
};
+1 -1
View File
@@ -47,6 +47,6 @@ async function apply() {
nav('/paste/create', 'pastebin', 'pastebin', PERM_LOGGEDIN);
}
global.Hydro.handler.paste = module.exports = {
global.Hydro.handler.pastebin = module.exports = {
PasteCreateHandler, PasteShowHandler, apply,
};