SuperAPI AI Directory

text-logic-diagram

General & other

View repository

Updated 10-16 09:30

About this skill

Text Logical Relationship Diagram

Convert text into precise logical relationship SVG diagrams, output as standalone HTML files.

Trigger Conditions

When users mention the following scenarios, actively use this skill:

  • "Generate logical diagram" / "Draw logical relationship diagram" / "Text to diagram"
  • "Logical breakdown" / "Break into diagrams" / "Visualization"
  • User pastes article/paragraph/argumentative content and requests logic analysis
  • "Progression diagram" / "Flowchart" / "Cycle diagram" / "Hierarchy diagram" / "Comparison diagram" / "Matrix diagram"
  • User requests structured visualization of text

Workflow

Step 1: Text Analysis

  1. Read through the full text, identify the core arguments, key concepts, and logical chains in the text
  2. Paragraph breakdown, split the text by natural paragraphs or logical paragraphs
  3. Determine relationship type, select the most suitable logical relationship for each paragraph:
Relationship Type Applicable Scenario Visual Features
Progression relationship Gradual conceptual development, deepening layer by layer Staircase arrangement, arrows from left to right or top to bottom
Process relationship Sequential steps, stage progression Linear/serpentine arrangement, numbered nodes
Cycle relationship Concepts cycle repeatedly, closed-loop feedback Circular arrangement, connected end to end
Hierarchical structure Inclusion, subordination, classification relationships Tree/pyramid/nested structure
Comparison relationship Contrast, comparison, pros and cons analysis Left-right/top-bottom symmetrical arrangement
Matrix relationship Multi-dimensional intersection, complex associations Grid/quadrant layout

Step 2: Concept Abstraction

  1. Extract keywords: Extract 2-6 core concepts from each paragraph
  2. Condense text: Keep each concept node's text within 15 characters
  3. Label relationships: Briefly annotate the connecting lines and arrows between concepts
  4. Organize by hierarchy: Distinguish primary concepts from secondary concepts

Step 3: Generate SVG Diagrams

Based on the analysis results, use this skill's design specifications to generate HTML files.

Multi-paragraph breakdown rules:

  • When the text contains multiple independent logical paragraphs, generate multiple SVG diagrams
  • Each diagram uses an independent <div class="diagram-card"> container
  • Label the paragraph title or logic type above each diagram
  • All diagrams are arranged in order in the same HTML file

Design System

Theme System

Supports dark and light theme switching, default is dark.

Dark theme (default)

Element Color
Page background #0a0a0a
Card background #141414
Node fill primary color #1a2332 → #243447
Node stroke #3f72af
Primary text #ffffff
Secondary text #8899aa
Connector lines #556677
Arrows #8899aa
Accent color #3f72af (blue), #5dade2 (bright blue)

Light theme

Element Color
Page background #f5f7fa
Card background #ffffff
Node fill primary color #e8edf2 → #dbe2ef
Node stroke #3f72af
Primary text #112d4e
Secondary text #4a6785
Connector lines #aabbcc
Arrows #8899aa
Accent color #3f72af (blue), #112d4e (dark blue)

Font specifications

  • Use the JetBrains Mono monospace font globally
  • Node title: 14px, font-weight 600
  • Node sublabel: 11px, font-weight 400
  • Connector line labels: 10px
  • Section title: 16px, font-weight 700
  • Legend text: 10px

SVG specifications

General specifications

  • Canvas size: viewBox for each diagram 0 0 800 500, adjust as needed
  • Padding: leave 40px on all sides
  • Arrow marker: small arrow, stroke width 1
  • Shadow effect: subtle shadow dx=1.5, dy=1.5, stdDeviation=2

Node styles

<!-- 带阴影的圆角矩形节点 -->
<rect x="X" y="Y" width="W" height="H" rx="8"
  fill="url(#nodeGrad)" stroke="#3f72af" stroke-width="1.5"
  filter="url(#shadow)"/>
<text x="CX" y="CY" class="text-primary" font-size="14" font-weight="600"
  text-anchor="middle">概念名称</text>

Connector line styles

<!-- 标准连接线 -->
<line x1="X1" y1="Y1" x2="X2" y2="Y2"
  stroke="#556677" stroke-width="1" marker-end="url(#arrow)"/>

<!-- 虚线连接(表示弱关系/隐含关系) -->
<line x1="X1" y1="Y1" x2="X2" y2="Y2"
  stroke="#556677" stroke-width="1" stroke-dasharray="4,3"
  marker-end="url(#arrow)"/>

<!-- 曲线连接(避开障碍物) -->
<path d="M X1 Y1 Q CX CY X2 Y2"
  stroke="#556677" stroke-width="1" fill="none"
  marker-end="url(#arrow)"/>

Relationship type visual specifications

Progressive relationship

  • Arrange in a stepped pattern from left to right
  • Nodes gradually rise or gradually increase in size
  • Arrows uniformly point to the right
  • Numbers may be used to mark the order (①②③)
  • Use light background colors to distinguish levels between layers

Process relationship

  • Linear arrangement or serpentine arrangement (wrap when there are more than 4 nodes)
  • Each node has a step number (circular badge)
  • Connector lines use solid arrows
  • The start node is emphasized with a dark color, and the end node uses a special style
  • Branch points use diamond-shaped nodes

Cyclic relationship

  • Circular arrangement, connected end to end
  • The core concept can be placed in the center
  • Connector lines follow the circular direction
  • Use curved lines instead of straight lines
  • Arrows point to the next node

Hierarchy

  • Tree structure: root node at the top, child nodes below
  • Or pyramid structure: wide at the bottom, narrow at the top
  • Nodes at the same level are horizontally aligned
  • Parent-child relationships are connected with vertical lines
  • Nested rectangles can be used to represent containment relationships

Comparison relationship

  • Left-right symmetrical layout
  • Separated in the middle by a vertical line or VS
  • Use different color tones on the left and right sides (such as blue vs orange)
  • Common points are placed in the middle or above
  • Differences are listed on both sides

Matrix relationship

  • Grid layout (2×2, 3×3, etc.)
  • Row and column headers label the dimensions
  • Place a concept in each cell
  • Quadrant-style partitioning (distinguished with light background colors)
  • Diagonal relationships are marked with a special color

Page Layout

  1. Header - Title + source text summary + theme toggle button
  2. Overview Card - Displays the detected relationship types and concept counts
  3. Diagram Area - Multiple SVG diagrams arranged in order, each with a title label
  4. Footer - Metadata

Multi-Diagram Layout Template

<div class="diagram-card">
  <div class="diagram-label">
    <span class="label-tag">递进关系</span>
    <span class="label-title">第一段:XXX 的渐进发展</span>
  </div>
  <div class="diagram-body">
    <svg class="diagram-svg" viewBox="0 0 800 500">
      <!-- SVG 内容 -->
    </svg>
  </div>
</div>

Chinese Adaptation Rules

  • Node text uses Chinese, technical terms remain in English
  • Chinese character width is approximately 2 times that of English; node width is estimated as 14px × character count × 0.7
  • Concept names are kept to 2-10 Chinese characters
  • Connector labels use 4-8 Chinese characters

Output Requirements

Always generate a standalone .html file, containing:

  • Inline CSS (including theme variables)
  • Multiple inline SVGs (split by paragraph)
  • A small amount of JavaScript for theme switching
  • The file can be opened directly in a browser

Cowrite Inline Mode

When the Cowrite prompt requires an "HTML/PPT explanatory diagram", use the following override rules:

  • Output only one 16:9 single-page logic diagram, with information density controlled to one PPT page
  • Use a light white-background theme, with all CSS and SVG inline, and no external resources referenced
  • Do not generate a header, theme toggle, overview card, footer, Logo, or watermark
  • Chinese text must be clear; prefer using the system Chinese font stack
  • Save the output as a standalone .html file, then hand it to cowrite_upload_asset and cowrite_insert_after