Title: No title
Domain: github.com
Links:
| "; return result; } function _DoImages(text) { // // Turn Markdown image shortcuts into tags. // // // First, handle reference-style labeled images: ![alt text][id] // /* text = text.replace(/ ( // wrap whole match in $1 !\[ (.*?) // alt text = $2 \] [ ]? // one optional space (?:\n[ ]*)? // one optional newline followed by spaces \[ (.*?) // id = $3 \] ) ()()()() // pad rest of backreferences /g, writeImageTag); */ text = text.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g, writeImageTag); // // Next, handle inline images:  // Don't forget: encode * and _ /* text = text.replace(/ ( // wrap whole match in $1 !\[ (.*?) // alt text = $2 \] \s? // One optional whitespace character \( // literal paren [ \t]* () // no id, so leave $3 empty ? // src url = $4 [ \t]* ( // $5 (['"]) // quote char = $6 (.*?) // title = $7 \6 // matching quote [ \t]* )? // title is optional \) ) /g, writeImageTag); */ text = text.replace(/(!\[(.*?)\]\s?\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g, writeImageTag); return text; } function attributeEncode(text) { // unconditionally replace angle brackets here -- what ends up in an attribute (e.g. alt or title) // never makes sense to have verbatim HTML in it (and the sanitizer would totally break it) return text.replace(/>/g, ">").replace(/"; return result; } function _DoHeaders(text) { // Setext-style headers: // Header 1 // ======== // // Header 2 // -------- // text = text.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm, function (wholeMatch, m1) { return "" + _RunSpanGamut(m1) + "\n\n"; } ); text = text.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm, function (matchFound, m1) { return "" + _RunSpanGamut(m1) + "\n\n"; } ); // atx-style headers: // # Header 1 // ## Header 2 // ## Header 2 with closing hashes ## // ... // ###### Header 6 // /* text = text.replace(/ ^(\#{1,6}) // $1 = string of #'s [ \t]* (.+?) // $2 = Header text [ \t]* \#* // optional closing #'s (not counted) \n+ /gm, function() {...}); */ text = text.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm, function (wholeMatch, m1, m2) { var h_level = m1.length; return "" + _RunSpanGamut(m2) + "\n\n"; } ); return text; } function _DoLists(text) { // // Form HTML ordered (numbered) and unordered (bulleted) lists. // // attacklab: add sentinel to hack around khtml/safari bug: // http://bugs.webkit.org/show_bug.cgi?id=11231 text += "~0"; // Re-usable pattern to match any entirel ul or ol list: /* var whole_list = / ( // $1 = whole list ( // $2 [ ]{0,3} // attacklab: g_tab_width - 1 ([*+-]|\d+[.]) // $3 = first list item marker [ \t]+ ) [^\r]+? ( // $4 ~0 // sentinel for workaround; should be $ | \n{2,} (?=\S) (?! // Negative lookahead for another list item marker [ \t]* (?:[*+-]|\d+[.])[ \t]+ ) ) ) /g */ var whole_list = /^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm; if (g_list_level) { text = text.replace(whole_list, function (wholeMatch, m1, m2) { var list = m1; var list_type = (m2.search(/[*+-]/g) > -1) ? "ul" : "ol"; var result = _ProcessListItems(list, list_type); // Trim any trailing whitespace, to put the closing `` // up on the preceding line, to get it past the current stupid // HTML block parser. This is a hack to work around the terrible // hack that is the HTML block parser. result = result.replace(/\s+$/, ""); result = "<" + list_type + ">" + result + "\n"; return result; }); } else { whole_list = /(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g; text = text.replace(whole_list, function (wholeMatch, m1, m2, m3) { var runup = m1; var list = m2; var list_type = (m3.search(/[*+-]/g) > -1) ? "ul" : "ol"; var result = _ProcessListItems(list, list_type); result = runup + "<" + list_type + ">\n" + result + "\n"; return result; }); } // attacklab: strip sentinel text = text.replace(/~0/, ""); return text; } var _listItemMarkers = { ol: "\\d+[.]", ul: "[*+-]" }; function _ProcessListItems(list_str, list_type) { // // Process the contents of a single ordered or unordered list, splitting it // into individual list items. // // list_type is either "ul" or "ol". // The $g_list_level global keeps track of when we're inside a list. // Each time we enter a list, we increment it; when we leave a list, // we decrement. If it's zero, we're not in a list anymore. // // We do this because when we're not inside a list, we want to treat // something like this: // // I recommend upgrading to version // 8. Oops, now this line is treated // as a sub-list. // // As a single paragraph, despite the fact that the second line starts // with a digit-period-space sequence. // // Whereas when we're inside a list (or sub-list), that line will be // treated as the start of a sub-list. What a kludge, huh? This is // an aspect of Markdown's syntax that's hard to parse perfectly // without resorting to mind-reading. Perhaps the solution is to // change the syntax rules such that sub-lists must start with a // starting cardinal number; e.g. "1." or "a.". g_list_level++; // trim trailing blank lines: list_str = list_str.replace(/\n{2,}$/, "\n"); // attacklab: add sentinel to emulate \z list_str += "~0"; // In the original attacklab showdown, list_type was not given to this function, and anything // that matched /[*+-]|\d+[.]/ would just create the next , causing this mismatch: // // Markdown rendered by WMD rendered by MarkdownSharp // ------------------------------------------------------------------ // 1. first 1. first 1. first // 2. second 2. second 2. second // - third 3. third * third // // We changed this to behave identical to MarkdownSharp. This is the constructed RegEx, // with {MARKER} being one of \d+[.] or [*+-], depending on list_type: /* list_str = list_str.replace(/ (^[ \t]*) // leading whitespace = $1 ({MARKER}) [ \t]+ // list marker = $2 ([^\r]+? // list item text = $3 (\n+) ) (?= (~0 | \2 ({MARKER}) [ \t]+) ) /gm, function(){...}); */ var marker = _listItemMarkers[list_type]; var re = new RegExp("(^[ \\t]*)(" + marker + ")[ \\t]+([^\\r]+?(\\n+))(?=(~0|\\1(" + marker + ")[ \\t]+))", "gm"); var last_item_had_a_double_newline = false; list_str = list_str.replace(re, function (wholeMatch, m1, m2, m3) { var item = m3; var leading_space = m1; var ends_with_double_newline = /\n\n$/.test(item); var contains_double_newline = ends_with_double_newline || item.search(/\n{2,}/) > -1; if (contains_double_newline || last_item_had_a_double_newline) { item = _RunBlockGamut(_Outdent(item), /* doNotUnhash = */true); } else { // Recursion for sub-lists: item = _DoLists(_Outdent(item)); item = item.replace(/\n$/, ""); // chomp(item) item = _RunSpanGamut(item); } last_item_had_a_double_newline = ends_with_double_newline; return "" + item + "\n"; } ); // attacklab: strip sentinel list_str = list_str.replace(/~0/g, ""); g_list_level--; return list_str; } function _DoCodeBlocks(text) { // // Process Markdown `` blocks. // /* text = text.replace(/ (?:\n\n|^) ( // $1 = the code block -- one or more lines, starting with a space/tab (?: (?:[ ]{4}|\t) // Lines must start with a tab or a tab-width of spaces - attacklab: g_tab_width .*\n+ )+ ) (\n*[ ]{0,3}[^ \t\n]|(?=~0)) // attacklab: g_tab_width /g ,function(){...}); */ // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug text += "~0"; text = text.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g, function (wholeMatch, m1, m2) { var codeblock = m1; var nextChar = m2; codeblock = _EncodeCode(_Outdent(codeblock)); codeblock = _Detab(codeblock); codeblock = codeblock.replace(/^\n+/g, ""); // trim leading newlines codeblock = codeblock.replace(/\n+$/g, ""); // trim trailing whitespace codeblock = "" + codeblock + "\n"; return "\n\n" + codeblock + "\n\n" + nextChar; } ); // attacklab: strip sentinel text = text.replace(/~0/, ""); return text; } function hashBlock(text) { text = text.replace(/(^\n+|\n+$)/g, ""); return "\n\n~K" + (g_html_blocks.push(text) - 1) + "K\n\n"; } function _DoCodeSpans(text) { // // * Backtick quotes are used for spans. // // * You can use multiple backticks as the delimiters if you want to // include literal backticks in the code span. So, this input: // // Just type ``foo `bar` baz`` at the prompt. // // Will translate to: // // Just type foo `bar` baz at the prompt. // // There's no arbitrary limit to the number of backticks you // can use as delimters. If you need three consecutive backticks // in your code, use four for delimiters, etc. // // * You can use spaces to get literal backticks at the edges: // // ... type `` `bar` `` ... // // Turns to: // // ... type `bar` ... // /* text = text.replace(/ (^|[^\\]) // Character before opening ` can't be a backslash (`+) // $2 = Opening run of ` ( // $3 = The code block [^\r]*? [^`] // attacklab: work around lack of lookbehind ) \2 // Matching closer (?!`) /gm, function(){...}); */ text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, function (wholeMatch, m1, m2, m3, m4) { var c = m3; c = c.replace(/^([ \t]*)/g, ""); // leading whitespace c = c.replace(/[ \t]*$/g, ""); // trailing whitespace c = _EncodeCode(c); c = c.replace(/:\/\//g, "~P"); // to prevent auto-linking. Not necessary in code *blocks*, but in code spans. Will be converted back after the auto-linker runs. return m1 + "" + c + ""; } ); return text; } function _EncodeCode(text) { // // Encode/escape certain characters inside Markdown code runs. // The point is that in code, these characters are literals, // and lose their special Markdown meanings. // // Encode all ampersands; HTML entities are not // entities within a Markdown code span. text = text.replace(/&/g, "&"); // Do the angle bracket song and dance: text = text.replace(//g, ">"); // Now, escape characters that are magic in Markdown: text = escapeCharacters(text, "\*_{}[]\\", false); // jj the line above breaks this: //--- //* Item // 1. Subitem // special char: * //--- return text; } function _DoItalicsAndBold(text) { // must go first: text = text.replace(/([\W_]|^)(\*\*|__)(?=\S)([^\r]*?\S[\*_]*)\2([\W_]|$)/g, "$1$3$4"); text = text.replace(/([\W_]|^)(\*|_)(?=\S)([^\r\*_]*?\S)\2([\W_]|$)/g, "$1$3$4"); return text; } function _DoBlockQuotes(text) { /* text = text.replace(/ ( // Wrap whole match in $1 ( ^[ \t]*>[ \t]? // '>' at the start of a line .+\n // rest of the first line (.+\n)* // subsequent consecutive lines \n* // blanks )+ ) /gm, function(){...}); */ text = text.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm, function (wholeMatch, m1) { var bq = m1; // attacklab: hack around Konqueror 3.5.4 bug: // "----------bug".replace(/^-/g,"") == "bug" bq = bq.replace(/^[ \t]*>[ \t]?/gm, "~0"); // trim one level of quoting // attacklab: clean up hack bq = bq.replace(/~0/g, ""); bq = bq.replace(/^[ \t]+$/gm, ""); // trim whitespace-only lines bq = _RunBlockGamut(bq); // recurse bq = bq.replace(/(^|\n)/g, "$1 "); // These leading spaces screw with content, so we need to fix that: bq = bq.replace( /(\s*[^\r]+?<\/pre>)/gm, function (wholeMatch, m1) { var pre = m1; // attacklab: hack around Konqueror 3.5.4 bug: pre = pre.replace(/^ /mg, "~0"); pre = pre.replace(/~0/g, ""); return pre; }); return hashBlock("\n" + bq + "\n"); } ); return text; } function _FormParagraphs(text, doNotUnhash) { // // Params: // $text - string to process with html tags // // Strip leading and trailing lines: text = text.replace(/^\n+/g, ""); text = text.replace(/\n+$/g, ""); var grafs = text.split(/\n{2,}/g); var grafsOut = []; var markerRe = /~K(\d+)K/; // // Wrap tags. // var end = grafs.length; for (var i = 0; i < end; i++) { var str = grafs[i]; // if this is an HTML marker, copy it if (markerRe.test(str)) { grafsOut.push(str); } else if (/\S/.test(str)) { str = _RunSpanGamut(str); str = str.replace(/^([ \t]*)/g, ""); str += "" grafsOut.push(str); } } // // Unhashify HTML blocks // if (!doNotUnhash) { end = grafsOut.length; for (var i = 0; i < end; i++) { var foundAny = true; while (foundAny) { // we may need several runs, since the data may be nested foundAny = false; grafsOut[i] = grafsOut[i].replace(/~K(\d+)K/g, function (wholeMatch, id) { foundAny = true; return g_html_blocks[id]; }); } } } return grafsOut.join("\n\n"); } function _EncodeAmpsAndAngles(text) { // Smart processing for ampersands and angle brackets that need to be encoded. // Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin: // http://bumppo.net/projects/amputator/ text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&"); // Encode naked <'s text = text.replace(/<(?![a-z\/?\$!])/gi, "<"); return text; } function _EncodeBackslashEscapes(text) { // // Parameter: String. // Returns: The string, with after processing the following backslash // escape sequences. // // attacklab: The polite way to do this is with the new // escapeCharacters() function: // // text = escapeCharacters(text,"\\",true); // text = escapeCharacters(text,"`*_{}[]()>#+-.!",true); // // ...but we're sidestepping its use of the (slow) RegExp constructor // as an optimization for Firefox. This function gets called a LOT. text = text.replace(/\\(\\)/g, escapeCharacters_callback); text = text.replace(/\\([`*_{}\[\]()>#+-.!])/g, escapeCharacters_callback); return text; } function _DoAutoLinks(text) { // note that at this point, all other URL in the text are already hyperlinked as // *except* for the case // automatically add < and > around unadorned raw hyperlinks // must be preceded by space/BOF and followed by non-word/EOF character text = text.replace(/(^|\s)(https?|ftp)(:\/\/[-A-Z0-9+&@#\/%?=~_|\[\]\(\)!:,\.;]*[-A-Z0-9+&@#\/%=~_|\[\]])($|\W)/gi, "$1<$2$3>$4"); // autolink anything like var replacer = function (wholematch, m1) { return "" + pluginHooks.plainLinkText(m1) + ""; } text = text.replace(/<((https?|ftp):[^'">\s]+)>/gi, replacer); // Email addresses: /* text = text.replace(/ < (?:mailto:)? ( [-.\w]+ \@ [-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+ ) > /gi, _DoAutoLinks_callback()); */ /* disabling email autolinking, since we don't do that on the server, either text = text.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, function(wholeMatch,m1) { return _EncodeEmailAddress( _UnescapeSpecialChars(m1) ); } ); */ return text; } function _UnescapeSpecialChars(text) { // // Swap back in all the special characters we've hidden. // text = text.replace(/~E(\d+)E/g, function (wholeMatch, m1) { var charCodeToReplace = parseInt(m1); return String.fromCharCode(charCodeToReplace); } ); return text; } function _Outdent(text) { // // Remove one level of line-leading tabs or spaces // // attacklab: hack around Konqueror 3.5.4 bug: // "----------bug".replace(/^-/g,"") == "bug" text = text.replace(/^(\t|[ ]{1,4})/gm, "~0"); // attacklab: g_tab_width // attacklab: clean up hack text = text.replace(/~0/g, "") return text; } function _Detab(text) { if (!/\t/.test(text)) return text; var spaces = [" ", " ", " ", " "], skew = 0, v; return text.replace(/[\n\t]/g, function (match, offset) { if (match === "\n") { skew = offset + 1; return match; } v = (offset - skew) % 4; skew = offset + 1; return spaces[v]; }); } // // attacklab: Utility functions // var _problemUrlChars = /(?:["'*()[\]:]|~D)/g; // hex-encodes some unusual "problem" chars in URLs to avoid URL detection problems function encodeProblemUrlChars(url) { if (!url) return ""; var len = url.length; return url.replace(_problemUrlChars, function (match, offset) { if (match == "~D") // escape for dollar return "%24"; if (match == ":") { if (offset == len - 1 || /[0-9\/]/.test(url.charAt(offset + 1))) return ":" } return "%" + match.charCodeAt(0).toString(16); }); } function escapeCharacters(text, charsToEscape, afterBackslash) { // First we have to escape the escape characters so that // we can build a character class out of them var regexString = "([" + charsToEscape.replace(/([\[\]\\])/g, "\\$1") + "])"; if (afterBackslash) { regexString = "\\\\" + regexString; } var regex = new RegExp(regexString, "g"); text = text.replace(regex, escapeCharacters_callback); return text; } function escapeCharacters_callback(wholeMatch, m1) { var charCodeToEscape = m1.charCodeAt(0); return "~E" + charCodeToEscape + "E"; } }; // end of the Markdown.Converter constructor })(); | https://github.com/sourcegraph-testing/eval_CodeSearchNet_JavaScript/raw/refs/heads/master/\"" |
| https://github.com/sourcegraph-testing/eval_CodeSearchNet_JavaScript/raw/refs/heads/master/30.js | |
| " + pluginHooks.plainLinkText(m1) + " | https://github.com/sourcegraph-testing/eval_CodeSearchNet_JavaScript/raw/refs/heads/master/\"" |