UNPKG

hexo-reslink

Version:

Automatically create resource links

16 lines 600 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.REG = /github:([a-zA-Z\d][a-zA-Z\d_-]*[a-zA-Z\d](\/[a-zA-Z\d._-]+[a-zA-Z\d])?)/; exports.process = (text) => { if (!exports.REG.test(text)) { return text; } text = text.replace(new RegExp(exports.REG, "g"), (words) => { const { 1: resName } = words.match(exports.REG); const url = `https://github.com/${resName}`; const title = `"Github Resource: ${resName}"`; return `[${resName}](${url} ${title})`; }); return text; }; //# sourceMappingURL=github.js.map