Skip to content

Commit e674084

Browse files
committed
feat: allow edit mind map if using mindelixir plaintext
1 parent 9937a11 commit e674084

9 files changed

Lines changed: 188 additions & 61 deletions

File tree

.agent/skills/mind-elixir-plaintext-format/SKILL.md

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Guide for understanding and converting Mind Elixir plaintext format
55

66
# Mind Elixir Plaintext Format
77

8-
This skill explains the Mind Elixir plaintext format specification and how to convert it to the Mind Elixir JSON data structure. The plaintext format is ideal for human editing, AI generation, and streaming scenarios.
8+
This skill explains the Mind Elixir plaintext format specification and how to convert between it and the Mind Elixir JSON data structure. The plaintext format is ideal for human editing, AI generation, and streaming scenarios.
99

1010
## 1. Format Overview
1111

@@ -64,25 +64,23 @@ Create connections between nodes using the `>` prefix and arrow syntax:
6464
- Node A [^id1]
6565
- Node B [^id2]
6666
- > [^id1] >-Forward Link-> [^id2]
67-
- > [^id2] <-Backward Link-< [^id1]
6867
```
6968

7069
**Formats:**
7170

7271
- Forward: `> [^sourceId] >-Label-> [^targetId]`
73-
- Backward: `> [^sourceId] <-Label-< [^targetId]`
7472

7573
### 2.3 Node Styling
7674

7775
Apply inline styles using JSON-like syntax:
7876

7977
```text
8078
- Root
81-
- Styled Node {color: #e87a90}
82-
- Another Node {color: #3298db, background: #ecf0f1}
79+
- Styled Node {"color": "#e87a90"}
80+
- Another Node {"color": "#3298db", "background": "#ecf0f1"}
8381
```
8482

85-
**Format:** `{property: value, property2: value2}` at the end of the topic text.
83+
**Format:** `{"property": "value", "property2": "value2"}` at the end of the topic text.
8684

8785
**Common Properties:**
8886

@@ -120,13 +118,13 @@ Create summary nodes that visually group previous siblings:
120118
```text
121119
- Project Planning
122120
- Phase 1: Research [^phase1]
123-
- Market Analysis {color: #3298db}
124-
- Competitor Study {color: #3298db}
121+
- Market Analysis {"color": "#3298db"}
122+
- Competitor Study {"color": "#3298db"}
125123
- }:2 Research Summary
126124
- Phase 2: Development [^phase2]
127-
- Frontend {color: #2ecc71}
128-
- Backend {color: #2ecc71}
129-
- Testing {color: #f39c12}
125+
- Frontend {"color": "#2ecc71"}
126+
- Backend {"color": "#2ecc71"}
127+
- Testing {"color": "#f39c12"}
130128
- } Development Summary
131129
- Phase 3: Launch [^phase3]
132130
- Marketing
@@ -135,11 +133,11 @@ Create summary nodes that visually group previous siblings:
135133
- > [^phase2] >-Leads to-> [^phase3]
136134
```
137135

138-
## 3. Converting Plaintext to Mind Elixir Data
136+
## 3. Conversion API
139137

140-
### 3.1 Using the Built-in Converter
138+
### 3.1 Plaintext to Mind Elixir Data
141139

142-
Mind Elixir provides a built-in converter for plaintext format:
140+
Mind Elixir provides a built-in converter for plaintext parsing:
143141

144142
```javascript
145143
import { plaintextToMindElixir } from 'mind-elixir/plaintextConverter'
@@ -154,7 +152,19 @@ const mindElixirData = plaintextToMindElixir(plaintext)
154152
// Returns MindElixirData object ready for mind.init() or mind.refresh()
155153
```
156154

157-
### 3.2 Integration Example
155+
### 3.2 Mind Elixir Data to Plaintext
156+
157+
You can also convert an existing mind map back to the plaintext format, which is useful for exporting and saving data:
158+
159+
```javascript
160+
import { mindElixirToPlaintext } from 'mind-elixir/plaintextConverter'
161+
162+
const mindElixirData = mind.getAllData()
163+
const plaintext = mindElixirToPlaintext(mindElixirData)
164+
// Returns a string containing the mind map in plaintext format
165+
```
166+
167+
### 3.3 Integration Example
158168

159169
```javascript
160170
import MindElixir from 'mind-elixir'
@@ -256,22 +266,22 @@ function safeParse(plaintext: string): MindElixirData | null {
256266

257267
## 7. Format Specification Summary
258268

259-
| Feature | Syntax | Example |
260-
| ------------------ | --------------------------- | -------------------------- |
261-
| Node | `- Topic` | `- My Node` |
262-
| Node with ID | `- Topic [^id]` | `- Node A [^id1]` |
263-
| Node with Style | `- Topic {prop: value}` | `- Node {color: #ff0000}` |
264-
| Bidirectional Link | `> [^id1] <-Label-> [^id2]` | `> [^a] <-connects-> [^b]` |
265-
| Forward Link | `> [^id1] >-Label-> [^id2]` | `> [^a] >-leads to-> [^b]` |
266-
| Backward Link | `> [^id1] <-Label-< [^id2]` | `> [^a] <-from-< [^b]` |
267-
| Summary (all) | `} Summary text` | `} Overview` |
268-
| Summary (N nodes) | `}:N Summary text` | `}:3 Last three items` |
269+
| Feature | Syntax | Example |
270+
| ------------------ | --------------------------- | ----------------------------- |
271+
| Node | `- Topic` | `- My Node` |
272+
| Node with ID | `- Topic [^id]` | `- Node A [^id1]` |
273+
| Node with Style | `- Topic {"prop": "value"}` | `- Node {"color": "#ff0000"}` |
274+
| Bidirectional Link | `> [^id1] <-Label-> [^id2]` | `> [^a] <-connects-> [^b]` |
275+
| Forward Link | `> [^id1] >-Label-> [^id2]` | `> [^a] >-leads to-> [^b]` |
276+
| Summary (all) | `} Summary text` | `} Overview` |
277+
| Summary (N nodes) | `}:N Summary text` | `}:3 Last three items` |
269278

270279
## 8. TypeScript Types
271280

272281
```typescript
273282
import type { MindElixirData, NodeObj } from 'mind-elixir'
274283

275-
// Converter function type
284+
// Converter functions
276285
function plaintextToMindElixir(plaintext: string): MindElixirData
286+
function mindElixirToPlaintext(data: MindElixirData): string
277287
```

.agents/skills/mind-elixir-plaintext-format/SKILL.md

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Guide for understanding and converting Mind Elixir plaintext format
55

66
# Mind Elixir Plaintext Format
77

8-
This skill explains the Mind Elixir plaintext format specification and how to convert it to the Mind Elixir JSON data structure. The plaintext format is ideal for human editing, AI generation, and streaming scenarios.
8+
This skill explains the Mind Elixir plaintext format specification and how to convert between it and the Mind Elixir JSON data structure. The plaintext format is ideal for human editing, AI generation, and streaming scenarios.
99

1010
## 1. Format Overview
1111

@@ -64,25 +64,23 @@ Create connections between nodes using the `>` prefix and arrow syntax:
6464
- Node A [^id1]
6565
- Node B [^id2]
6666
- > [^id1] >-Forward Link-> [^id2]
67-
- > [^id2] <-Backward Link-< [^id1]
6867
```
6968

7069
**Formats:**
7170

7271
- Forward: `> [^sourceId] >-Label-> [^targetId]`
73-
- Backward: `> [^sourceId] <-Label-< [^targetId]`
7472

7573
### 2.3 Node Styling
7674

7775
Apply inline styles using JSON-like syntax:
7876

7977
```text
8078
- Root
81-
- Styled Node {color: #e87a90}
82-
- Another Node {color: #3298db, background: #ecf0f1}
79+
- Styled Node {"color": "#e87a90"}
80+
- Another Node {"color": "#3298db", "background": "#ecf0f1"}
8381
```
8482

85-
**Format:** `{property: value, property2: value2}` at the end of the topic text.
83+
**Format:** `{"property": "value", "property2": "value2"}` at the end of the topic text.
8684

8785
**Common Properties:**
8886

@@ -120,13 +118,13 @@ Create summary nodes that visually group previous siblings:
120118
```text
121119
- Project Planning
122120
- Phase 1: Research [^phase1]
123-
- Market Analysis {color: #3298db}
124-
- Competitor Study {color: #3298db}
121+
- Market Analysis {"color": "#3298db"}
122+
- Competitor Study {"color": "#3298db"}
125123
- }:2 Research Summary
126124
- Phase 2: Development [^phase2]
127-
- Frontend {color: #2ecc71}
128-
- Backend {color: #2ecc71}
129-
- Testing {color: #f39c12}
125+
- Frontend {"color": "#2ecc71"}
126+
- Backend {"color": "#2ecc71"}
127+
- Testing {"color": "#f39c12"}
130128
- } Development Summary
131129
- Phase 3: Launch [^phase3]
132130
- Marketing
@@ -135,11 +133,11 @@ Create summary nodes that visually group previous siblings:
135133
- > [^phase2] >-Leads to-> [^phase3]
136134
```
137135

138-
## 3. Converting Plaintext to Mind Elixir Data
136+
## 3. Conversion API
139137

140-
### 3.1 Using the Built-in Converter
138+
### 3.1 Plaintext to Mind Elixir Data
141139

142-
Mind Elixir provides a built-in converter for plaintext format:
140+
Mind Elixir provides a built-in converter for plaintext parsing:
143141

144142
```javascript
145143
import { plaintextToMindElixir } from 'mind-elixir/plaintextConverter'
@@ -154,7 +152,19 @@ const mindElixirData = plaintextToMindElixir(plaintext)
154152
// Returns MindElixirData object ready for mind.init() or mind.refresh()
155153
```
156154

157-
### 3.2 Integration Example
155+
### 3.2 Mind Elixir Data to Plaintext
156+
157+
You can also convert an existing mind map back to the plaintext format, which is useful for exporting and saving data:
158+
159+
```javascript
160+
import { mindElixirToPlaintext } from 'mind-elixir/plaintextConverter'
161+
162+
const mindElixirData = mind.getAllData()
163+
const plaintext = mindElixirToPlaintext(mindElixirData)
164+
// Returns a string containing the mind map in plaintext format
165+
```
166+
167+
### 3.3 Integration Example
158168

159169
```javascript
160170
import MindElixir from 'mind-elixir'
@@ -256,22 +266,22 @@ function safeParse(plaintext: string): MindElixirData | null {
256266

257267
## 7. Format Specification Summary
258268

259-
| Feature | Syntax | Example |
260-
| ------------------ | --------------------------- | -------------------------- |
261-
| Node | `- Topic` | `- My Node` |
262-
| Node with ID | `- Topic [^id]` | `- Node A [^id1]` |
263-
| Node with Style | `- Topic {prop: value}` | `- Node {color: #ff0000}` |
264-
| Bidirectional Link | `> [^id1] <-Label-> [^id2]` | `> [^a] <-connects-> [^b]` |
265-
| Forward Link | `> [^id1] >-Label-> [^id2]` | `> [^a] >-leads to-> [^b]` |
266-
| Backward Link | `> [^id1] <-Label-< [^id2]` | `> [^a] <-from-< [^b]` |
267-
| Summary (all) | `} Summary text` | `} Overview` |
268-
| Summary (N nodes) | `}:N Summary text` | `}:3 Last three items` |
269+
| Feature | Syntax | Example |
270+
| ------------------ | --------------------------- | ----------------------------- |
271+
| Node | `- Topic` | `- My Node` |
272+
| Node with ID | `- Topic [^id]` | `- Node A [^id1]` |
273+
| Node with Style | `- Topic {"prop": "value"}` | `- Node {"color": "#ff0000"}` |
274+
| Bidirectional Link | `> [^id1] <-Label-> [^id2]` | `> [^a] <-connects-> [^b]` |
275+
| Forward Link | `> [^id1] >-Label-> [^id2]` | `> [^a] >-leads to-> [^b]` |
276+
| Summary (all) | `} Summary text` | `} Overview` |
277+
| Summary (N nodes) | `}:N Summary text` | `}:3 Last three items` |
269278

270279
## 8. TypeScript Types
271280

272281
```typescript
273282
import type { MindElixirData, NodeObj } from 'mind-elixir'
274283

275-
// Converter function type
284+
// Converter functions
276285
function plaintextToMindElixir(plaintext: string): MindElixirData
286+
function mindElixirToPlaintext(data: MindElixirData): string
277287
```

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,9 @@ For the specific format specification, please refer to the [Mind Elixir Plain Te
6161
## Manually installing the plugin
6262

6363
- Copy over `main.js`, `styles.css`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/your-plugin-id/`.
64+
65+
## TODO
66+
67+
- Support node copy and paste
68+
- Support reverse edit in `mindelixir` code block
69+
- Record links delta if modified

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
},
2626
"dependencies": {
2727
"@types/mdast": "^4.0.4",
28-
"mind-elixir": "5.9.0",
28+
"mind-elixir": "5.9.3",
2929
"obsidian": "latest",
30+
"rehype-stringify": "^10.0.1",
3031
"remark": "^15.0.1",
3132
"remark-gfm": "^4.0.0",
3233
"remark-parse": "^11.0.0",
3334
"remark-rehype": "^11.1.1",
34-
"rehype-stringify": "^10.0.1",
3535
"unified": "^11.0.0",
3636
"unist-util-visit": "^5.0.0"
3737
}

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

skills-lock.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"version": 1,
3+
"skills": {
4+
"Mind Elixir Plaintext Format": {
5+
"source": "ssshooter/mind-elixir-core",
6+
"sourceType": "github",
7+
"computedHash": "249dae11f2ed53b06134d0d4fd2128ae4121908a2038541f02df5744d381824b"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)