';
- const claudeContent = renderMarkdownToHtml(memoryData.claudeMd.content);
+ for (const [sectionName, sectionContent] of Object.entries(parsed.sections)) {
+ if (!sectionContent || sectionName === '_intro') continue;
+ const lines = sectionContent.split('\n').filter(l => l.trim() && !l.trim().startsWith('|'));
+ if (lines.length === 0) continue;
+ html += `
${escapeHtml(sectionName)}
`;
+ for (const line of lines) {
+ const cleanLine = line.replace(/^[-*]\s*/, '').replace(/\*\*(.+?)\*\*/g, '$1').trim();
+ if (!cleanLine) continue;
+ html += `
${escapeHtml(cleanLine)}
`;
+ }
+ html += `
`;
+ }
+
+ return html;
+ }
+
+ function hasStructuredContent(parsed) {
+ return Object.keys(parsed.fields).length > 0
+ || parsed.tables.length > 0
+ || Object.entries(parsed.sections).some(([name, content]) => name !== '_intro' && content && content.trim());
+ }
+
+ function renderMemoryOverview() {
+ if (!memoryData.claudeMd) return;
+
+ const parsed = parseMemoryMarkdown(memoryData.claudeMd.content);
+ let contentHtml;
+
+ if (hasStructuredContent(parsed)) {
+ contentHtml = renderParsedFlatTables(parsed);
+ } else {
+ // Fallback: raw markdown in a searchable file-card
+ const rendered = renderMarkdownToHtml(memoryData.claudeMd.content);
+ contentHtml = `
function renderMemoryDirectory(dirName) {
const files = memoryData.memoryDirs[dirName] || [];
- // Context directory uses flat list view
- if (dirName === 'context') {
- renderMemoryDirectoryFlat(dirName, files);
- return;
- }
-
- // All other directories use card grid view
- let html = `
-
- 🔍
-
-
-
- `;
+ // All directories use card grid view
+ let html = '';
+ html += renderSearchBoxHtml('Search ' + dirName + '...');
+ html += `
`;
for (const file of files) {
const p = file.parsed;
@@ -2798,6 +3007,7 @@
Edit
html += `
+
${escapeHtml(title)}
${fieldsHtml}
${escapeHtml(preview)}
@@ -2815,57 +3025,82 @@
Edit
}
function renderMemoryDirectoryFlat(dirName, files) {
- let html = `
-
- 🔍
-
-
-
- `;
+ let html = '';
+ html += renderSearchBoxHtml('Search ' + dirName + '...');
+ html += `
`;
for (const file of files) {
const p = file.parsed;
+ const displayName = p.title || getDisplayName(file.name);
+ let isFirstCard = true;
+
+ // Helper to wrap content in a file-card with optional header
+ function wrapFileCard(innerHtml) {
+ let card = `
`;
+ return card;
+ }
// Render fields as a key-value table
const fieldEntries = Object.entries(p.fields);
if (fieldEntries.length > 0) {
- html += `
`;
+ let tableHtml = `
`;
for (const [key, value] of fieldEntries) {
- html += `
${escapeHtml(key)}
${escapeHtml(value)}
`;
+ tableHtml += `
${escapeHtml(key)}
${escapeHtml(value)}
`;
}
- html += `
`;
+ tableHtml += `
`;
+ html += wrapFileCard(tableHtml);
}
- // Render parsed tables (teams, tools, etc.) as proper HTML tables
+ // Render parsed tables
for (const table of p.tables) {
- html += `
`;
+ let tableHtml = `
`;
for (const h of table.headers) {
- html += `
${escapeHtml(h)}
`;
+ tableHtml += `
${escapeHtml(h)}
`;
}
- html += `
`;
+ tableHtml += ``;
for (const row of table.rows) {
const searchData = row.join(' ').toLowerCase();
- html += `
`;
+ tableHtml += `
`;
for (const cell of row) {
- html += `
${escapeHtml(cell)}
`;
+ tableHtml += `
${escapeHtml(cell)}
`;
}
- html += `
`;
+ tableHtml += ``;
}
- html += `
`;
+ tableHtml += `
`;
+ html += wrapFileCard(tableHtml);
}
- // Render non-table section content as list items
+ // Render non-table section content
for (const [sectionName, sectionContent] of Object.entries(p.sections)) {
if (!sectionContent || sectionName === '_intro') continue;
const lines = sectionContent.split('\n').filter(l => l.trim() && !l.trim().startsWith('|'));
if (lines.length === 0) continue;
- html += `
${escapeHtml(sectionName)}
`;
+ let tableHtml = `
${escapeHtml(sectionName)}
`;
for (const line of lines) {
const cleanLine = line.replace(/^[-*]\s*/, '').replace(/\*\*(.+?)\*\*/g, '$1').trim();
if (!cleanLine) continue;
- html += `
${escapeHtml(cleanLine)}
`;
+ tableHtml += `
${escapeHtml(cleanLine)}
`;
}
- html += `
`;
+ tableHtml += `
`;
+ html += wrapFileCard(tableHtml);
+ }
+
+ // If no structured content was rendered, ensure the header+edit button still appear
+ if (isFirstCard) {
+ html += `