Enhance UI and functionality for Chain Workbench and related features
- Introduced a wide two-column layout for the Chain Workbench modal, improving user experience and accessibility. - Added new styles for workbench components, including headers, filters, and main containers, to enhance visual organization. - Updated chain templates to allow for multiple distinct matches per template, improving flexibility in template matching. - Enhanced documentation to clarify the new settings and commands related to the Chain Workbench and edge detection features. - Implemented logging for better tracking of missing configurations, ensuring users are informed about any loading issues.
This commit is contained in:
1 parent
c044d6e8db
commit
725adb5302
47 files changed
+4161
-646
No files matched your search
+38
-11
@@ -24,6 +24,7 @@ export interface RenderOptions {
|
||||
vocabulary?: Vocabulary | null;
|
||||
noteType?: string; // Fallback für effective_type
|
||||
sectionEdgeTypes?: Map<string, Map<string, string>>; // fromBlockId -> (toBlockId -> edgeType) für manuell geänderte Edge-Types
|
||||
noteEdges?: Map<string, Map<string, string>>; // fromBlockId (oder "ROOT") -> (toNote oder toNote#Abschnitt -> edgeType)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -289,6 +290,11 @@ function renderCaptureText(
|
||||
// Diese werden später in einem zweiten Durchlauf hinzugefügt
|
||||
const backwardEdges = ""; // Wird später hinzugefügt
|
||||
|
||||
// WP-26: Note-Edges (Link zu anderer Note oder Note#Abschnitt) für diese Section
|
||||
const noteEdgesStr = sectionInfo?.blockId
|
||||
? renderNoteEdges(sectionInfo.blockId, context)
|
||||
: "";
|
||||
|
||||
// Use template if provided
|
||||
if (step.output?.template) {
|
||||
const templateText = renderTemplate(step.output.template, {
|
||||
@@ -298,12 +304,12 @@ function renderCaptureText(
|
||||
});
|
||||
|
||||
// WP-26: Template mit Heading, Section-Type und Edges kombinieren
|
||||
return combineSectionParts(heading, sectionTypeCallout, templateText, references, forwardEdges, backwardEdges);
|
||||
return combineSectionParts(heading, sectionTypeCallout, templateText, references, forwardEdges, backwardEdges, noteEdgesStr);
|
||||
}
|
||||
|
||||
// Default: use section if provided, otherwise just the text
|
||||
if (step.section) {
|
||||
return combineSectionParts(heading, sectionTypeCallout, text, references, forwardEdges, backwardEdges);
|
||||
return combineSectionParts(heading, sectionTypeCallout, text, references, forwardEdges, backwardEdges, noteEdgesStr);
|
||||
}
|
||||
|
||||
return text;
|
||||
@@ -410,8 +416,8 @@ function renderCaptureTextLine(
|
||||
|
||||
// WP-26: Template mit Heading, Section-Type und Edges kombinieren (wenn Heading vorhanden)
|
||||
if (headingPrefix) {
|
||||
// Backward-Edges werden später im zweiten Durchlauf hinzugefügt
|
||||
return combineSectionParts(heading, sectionTypeCallout, "", references, forwardEdges, "");
|
||||
const noteEdgesStr = sectionInfo?.blockId ? renderNoteEdges(sectionInfo.blockId, context) : "";
|
||||
return combineSectionParts(heading, sectionTypeCallout, "", references, forwardEdges, "", noteEdgesStr);
|
||||
}
|
||||
|
||||
return templateText;
|
||||
@@ -419,8 +425,8 @@ function renderCaptureTextLine(
|
||||
|
||||
// WP-26: Wenn Heading vorhanden, mit Section-Type und Edges kombinieren
|
||||
if (headingPrefix) {
|
||||
// Backward-Edges werden später im zweiten Durchlauf hinzugefügt
|
||||
return combineSectionParts(heading, sectionTypeCallout, "", references, forwardEdges, "");
|
||||
const noteEdgesStr = sectionInfo?.blockId ? renderNoteEdges(sectionInfo.blockId, context) : "";
|
||||
return combineSectionParts(heading, sectionTypeCallout, "", references, forwardEdges, "", noteEdgesStr);
|
||||
}
|
||||
|
||||
// Default: text with heading prefix if configured
|
||||
@@ -672,7 +678,8 @@ function combineSectionParts(
|
||||
content: string,
|
||||
references: string,
|
||||
autoEdges: string,
|
||||
backwardEdges: string = ""
|
||||
backwardEdges: string = "",
|
||||
noteEdges: string = ""
|
||||
): string {
|
||||
const parts: string[] = [];
|
||||
|
||||
@@ -688,8 +695,8 @@ function combineSectionParts(
|
||||
parts.push(content);
|
||||
}
|
||||
|
||||
// WP-26: Alle Edges im abstract wrapper am Ende der Sektion
|
||||
const allEdges = [references, autoEdges, backwardEdges].filter(e => e.trim());
|
||||
// WP-26: Alle Edges im abstract wrapper am Ende der Sektion (inkl. Note-Edges mit [[Note#Abschnitt]])
|
||||
const allEdges = [references, autoEdges, backwardEdges, noteEdges].filter(e => e.trim());
|
||||
if (allEdges.length > 0) {
|
||||
const abstractWrapper = buildAbstractWrapper(allEdges.join("\n"));
|
||||
if (abstractWrapper) {
|
||||
@@ -723,8 +730,8 @@ function buildAbstractWrapper(edgesContent: string): string | null {
|
||||
edgeGroups.set(currentEdgeType, []);
|
||||
}
|
||||
} else {
|
||||
// Prüfe auf Link: > [[#^block-id]]
|
||||
const linkMatch = line.match(/^>\s*(\[\[#\^.+?\]\])$/);
|
||||
// Prüfe auf Link: > [[#^block-id]] oder > [[Note]] / > [[Note#Abschnitt]]
|
||||
const linkMatch = line.match(/^>\s*(\[\[[^\]]+?\]\])$/);
|
||||
if (linkMatch && linkMatch[1] && currentEdgeType) {
|
||||
const links = edgeGroups.get(currentEdgeType) || [];
|
||||
links.push(linkMatch[1]);
|
||||
@@ -832,6 +839,26 @@ function renderReferences(
|
||||
return edgeCallouts.join("\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Generiert Edge-Callouts für Note-Verbindungen ([[Note]] oder [[Note#Abschnitt]]).
|
||||
* Format: > [!edge] <edge_type>\n> [[toNote]] bzw. > [[toNote#Abschnitt]]
|
||||
*/
|
||||
function renderNoteEdges(blockId: string, context: RenderContext): string {
|
||||
const noteEdges = context.options.noteEdges;
|
||||
if (!noteEdges) return "";
|
||||
|
||||
const fromBlock = noteEdges.get(blockId);
|
||||
if (!fromBlock || fromBlock.size === 0) return "";
|
||||
|
||||
const edgeCallouts: string[] = [];
|
||||
for (const [toNote, edgeType] of fromBlock.entries()) {
|
||||
if (!toNote || !edgeType) continue;
|
||||
edgeCallouts.push(`> [!edge] ${edgeType}`);
|
||||
edgeCallouts.push(`> [[${toNote}]]`);
|
||||
}
|
||||
return edgeCallouts.join("\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Ermittelt den effektiven Section-Type basierend auf Heading-Level.
|
||||
* Wenn eine Section keinen expliziten Type hat, wird der Type der vorherigen Section
|
||||
|
||||
Reference in new issue
Block a user