1window.WpVaMarkdown = (function() { 2 function escapeHtml(value) { 3 return String(value || "") 4 .replace(/&/g, "&") 5 .replace(/</g, "<") 6 .replace(/>/g, ">"); 7 } 8 9 function formatInline(value) { 10 return String(value || "") 11 .replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>") 12 .replace(/__(.+?)__/g, "<strong>$1</strong>") 13 .replace(/\*(.+?)\*/g, "<em>$1</em>") 14 .replace(/_(.+?)_/g, "<em>$1</em>"); 15 } 16 17 function format(source) { 18 const lines = escapeHtml(source).split(/\r\n|\n|\r/); 19 const blocks = []; 20 let paragraphLines = []; 21 let listItems = null; 22 23 function flushParagraph() { 24 if (!paragraphLines.length) { 25 return; 26 } 27 blocks.push("<p>" + formatInline(paragraphLines.join("<br>")) + "</p>"); 28 paragraphLines = []; 29 } 30 31 function flushList() { 32 if (!listItems) { 33 return; 34 } 35 blocks.push( 36 "<ul>" + 37 listItems.map(function(item) { 38 return "<li>" + formatInline(item) + "</li>"; 39 }).join("") + 40 "</ul>" 41 ); 42 listItems = null; 43 } 44 45 lines.forEach(function(line) { 46 const listMatch = line.match(/^\s*[-*]\s+(.+)$/); 47 if (listMatch) { 48 flushParagraph(); 49 if (!listItems) { 50 listItems = []; 51 } 52 listItems.push(listMatch[1]); 53 return; 54 } 55 if (!line.trim()) { 56 flushList(); 57 flushParagraph(); 58 return; 59 } 60 flushList(); 61 paragraphLines.push(line); 62 }); 63 flushList(); 64 flushParagraph(); 65 66 return blocks.join(""); 67 } 68 69 return {format: format}; 70})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.