MCPcopy
hub / github.com/github/awesome-copilot / miniMd

Function miniMd

extensions/java-modernization-studio/renderer.mjs:852–870  ·  view source on GitHub ↗
(md)

Source from the content-addressed store, hash-verified

850 return '<div class="card"><div class="empty"><div class="big">' + esc(big) + "</div><div>" + sub + "</div>" + (action ? '<div class="actions" style="justify-content:center;margin-top:14px">' + action + "</div>" : "") + "</div></div>";
851 }
852 function miniMd(md) {
853 const lines = esc(md).split(/\r?\n/);
854 let out = "";
855 let inList = false;
856 for (let line of lines) {
857 if (/^\s*[-*]\s+/.test(line)) {
858 if (!inList) { out += "<ul>"; inList = true; }
859 out += "<li>" + line.replace(/^\s*[-*]\s+/, "") + "</li>";
860 continue;
861 }
862 if (inList) { out += "</ul>"; inList = false; }
863 const h = line.match(/^(#{1,3})\s+(.*)/);
864 if (h) { out += "<h" + h[1].length + ">" + h[2] + "</h" + h[1].length + ">"; continue; }
865 if (line.trim() === "") { out += "<br>"; continue; }
866 out += "<p style='margin:4px 0'>" + line + "</p>";
867 }
868 if (inList) out += "</ul>";
869 return out.replace(/`([^`]+)`/g, "<code>$1</code>");
870 }
871
872 // ---- shell ---------------------------------------------------------------
873

Callers 1

summaryTabFunction · 0.85

Calls 1

escFunction · 0.85

Tested by

no test coverage detected