Skip to content

Conversation

jinzcdev
Copy link

@jinzcdev jinzcdev commented May 8, 2025

Issue Description

According to the xmindmark syntax documentation, the correct format for .xmindmark text should be:

Central Topic
- Main Topic 1
- Main Topic 2

I use the command xmindmark -f xmind example.xmindmark to generate the example.xmind file, which is a valid .xmind file.


However, when I use the command xmindmark from example.xmind, the generated example.xmindmark content has the following format:

$ xmindmark from example.xmind
Central Topic
    - Main Topic 1
    - Main Topic 2
Incorrect Xmindmark Syntax

When I attempt to convert example.xmindmark back to example.xmind using the xmindmark command, a parsing error occurs:

$ xmindmark -f xmind example.xmindmark
/Users/{me}/.nvm/versions/node/v22.11.0/lib/node_modules/xmindmark/dist/src/parser/mindmap.js:229
    parentObject = parentObject.rootTopic || parentObject;
                                ^

TypeError: Cannot read properties of undefined (reading 'rootTopic')
    at addTopic (/Users/{me}/.nvm/versions/node/v22.11.0/lib/node_modules/xmindmark/dist/src/parser/mindmap.js:229:33)
    at addLine (/Users/{me}/.nvm/versions/node/v22.11.0/lib/node_modules/xmindmark/dist/src/parser/mindmark.js:69:65)
    at /Users/{me}/.nvm/versions/node/v22.11.0/lib/node_modules/xmindmark/dist/src/parser/mindmark.js:146:62
    at Array.forEach (<anonymous>)
    at createMapByXMindMark (/Users/{me}/.nvm/versions/node/v22.11.0/lib/node_modules/xmindmark/dist/src/parser/mindmark.js:146:46)
    at /Users/{me}/.nvm/versions/node/v22.11.0/lib/node_modules/xmindmark/dist/src/lib/xmindmark-to-xmind.js:34:64
    at Generator.next (<anonymous>)
    at /Users/{me}/.nvm/versions/node/v22.11.0/lib/node_modules/xmindmark/dist/src/lib/xmindmark-to-xmind.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/{me}/.nvm/versions/node/v22.11.0/lib/node_modules/xmindmark/dist/src/lib/xmindmark-to-xmind.js:4:12)

Root Cause: The indentation handling in src/lib/xmind-to-xmindmark.ts is incorrect, causing the generated example.xmindmark file to deviate from the standard xmindmark syntax. Additionally, the original unit tests were also flawed.

Solution

Modify the indentation logic in src/lib/xmind-to-xmindmark.ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant