UNPKG

@speed-highlight/core

Version:

🌈 Light, fast, and easy to use, dependencies free javascript syntax highlighter, with automatic language detection

2 lines (1 loc) • 1.37 kB
var c=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var r=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var u=(e,t)=>{for(var s in t)c(e,s,{get:t[s],enumerable:!0})},l=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of r(t))!i.call(e,a)&&a!==s&&c(e,a,{get:()=>t[a],enumerable:!(n=o(t,a))||n.enumerable});return e};var p=e=>l(c({},"__esModule",{value:!0}),e);var b={};u(b,{default:()=>m});module.exports=p(b);var m=[{match:/\/\*\*((?!\*\/)[^])*(\*\/)?/g,sub:"jsdoc"},{match:/\/\/.*\n?|\/\*((?!\*\/)[^])*(\*\/)?/g,sub:"todo"},{expand:"str"},{match:/`((?!`)[^]|\\[^])*`?/g,sub:"js_template_literals"},{type:"kwd",match:/=>|\b(this|set|get|as|async|await|break|case|catch|class|const|constructor|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|if|implements|import|in|instanceof|interface|let|var|of|new|package|private|protected|public|return|static|super|switch|throw|throws|try|typeof|void|while|with|yield)\b/g},{match:/\/((?!\/)[^\r\n\\]|\\.)+\/[dgimsuy]*/g,sub:"regex"},{expand:"num"},{type:"num",match:/\b(NaN|null|undefined|[A-Z][A-Z_]*)\b/g},{type:"bool",match:/\b(true|false)\b/g},{type:"oper",match:/[/*+:?&|%^~=!,<>.^-]+/g},{type:"class",match:/\b[A-Z][\w_]*\b/g},{type:"func",match:/[a-zA-Z$_][\w$_]*(?=\s*((\?\.)?\s*\(|=\s*(\(?[\w,{}\[\])]+\)? =>|function\b)))/g}];