MCPcopy Create free account
hub / github.com/Cosmian/kms / getCratePath

Function getCratePath

documentation/docs/javascripts/log_filter.js:197–213  ·  view source on GitHub ↗
(tableEl)

Source from the content-addressed store, hash-verified

195const GITHUB_BASE = "https://github.com/Cosmian/kms/blob";
196
197function getCratePath(tableEl) {
198 // Walk backwards from the table to find the nearest "Crate path: `...`" paragraph.
199 let node = tableEl.previousElementSibling;
200 while (node) {
201 if (node.tagName === "P" || node.tagName === "DIV") {
202 const text = node.textContent || "";
203 if (text.includes("Crate path:")) {
204 const code = node.querySelector("code");
205 if (code) return code.textContent.trim().replace(/\/$/, "");
206 }
207 }
208 // Stop at section headings
209 if (node.tagName === "H2" || node.tagName === "H3") break;
210 node = node.previousElementSibling;
211 }
212 return null;
213}
214
215function linkifyFileCells(content) {
216 const version = (window.KMS_VERSION || "develop").trim();

Callers 1

linkifyFileCellsFunction · 0.85

Calls 1

includesMethod · 0.45

Tested by

no test coverage detected