Skip to content

Open and write WiseMapping .wxml maps - #4

Open
Martin-PB wants to merge 3 commits into
mainfrom
mp-wisemapping-wxml
Open

Martin-PB wants to merge 3 commits into
mainfrom
mp-wisemapping-wxml

Conversation

@Martin-PB

@Martin-PB Martin-PB commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Intent

Fourth step of the "every mind map format" program (one PR per format): read and write WiseMapping .wxml maps. WiseMapping stores its maps as flat XML — the current "tango" dialect and the older "pela" files — and Cartocortex can now open these files and export to them.

This PR was based on the branch of PR #3 (mp-mindmanager-mmap), itself based on PR #1. PRs #1 and #3 are now merged, so this PR is reviewed against main.

What was done

  • src/wisemapping.ts (new): fromWisemapping / toWisemapping reader and writer, reusing the strict XML parser of the .xmind reader (no DOCTYPE, predefined entities only).
    • Reading: texts (single-line text attribute or multi-line <text> block), notes ("tango" CDATA or the percent-encoded attribute of older files), <link url> links, <eicon id> icons (emoji), background and text colours (bgColor, fontStyle), bold/italic, shapes (box → rect, line → line, ellipse by default), folding (shrink), order (stable sort), positions, <relationship srcTopicId destTopicId> → relationship lines, map-level free branches → floating topics (positions kept). A topic's side comes from its x position: all left → Logic (left), mixed → Map (right side first).
    • Writing (toWisemapping, Save as .wxml and the "Export WiseMapping" button): the first sheet becomes the central <topic central="true"> map, the following sheets and floating topics become free branches (positions recomputed from the tree shape: ±200 px at level 1, ±90 px deeper); relations are written back with numeric pre-order ids.
    • Documented losses: priorities, progress, images, per-word style, boundaries, summaries, inter-topic links and themes are not carried; relation buttons pointing at unknown topics are ignored.
  • src/wisemapping.test.ts (new): 5 vitest tests — a full tango sample (multi-line note, link, icon, styles, folding, relation, free branch), a "pela" file with order and no central attribute, strict errors (DOCTYPE, no topic, invalid XML), a full round trip (multi-line text containing ]]>, folding, relations, sheet 2 as a free branch at {200, 250}), writing geometry.
  • src/files.ts: wiring of the wxml format into docBytes / parseDoc, and the open/save dialog filters and extensions.
  • src/files.test.ts: a plan.wxml round-trip test (flat XML, one map per file, following sheets as free branches).
  • src/App.tsx: "WiseMapping (.wxml)" entry in the export menu.
  • README.md: a WiseMapping paragraph (format, reading, writing, losses, provenance) and updated format lists.

What the agent did

  • Format research: the official source of the WiseMapping XML serializer (XMLSerializerTango / XMLSerializerPela, wisemapping-frontend) and the MindmapImporter importer.
  • Full implementation of the module + tests.
  • "Sandbox twin" validation: the module was replayed in a sandbox with a harness of 58 checks, all green (tango/pela reading, single-line text attributes vs multi-line blocks, CDATA vs percent-encoded notes, colours, styles, shapes, folding, order, positions and sides, relations, free branches, round trip, strict errors, writing geometry).
  • Not run here: npm test, tsc, npm run build (no Node in the sandbox) — the two CI jobs of the PR cover them instead.
  • Not verified against a real WiseMapping: the format comes from the WiseMapping sources, not from a round trip with the application.
  • CI fix (2026-10-18): a second commit repairs two CI failures — the WiseMapping reader's relation filter now carries a type guard (the compiler still saw potentially missing endpoints and refused the build), and the FreeMind gzip test compares the two reads without their fresh ids (a fix already present on the FreeMind branch).

Human checks


Agent: Vibe (Mistral, glm-5-latest-short)
Reviewed-by: Martin-PB

WiseMapping keeps its maps as plain XML (the current "tango" dialect
and the older "pela" files), and Cartocortex now reads and writes
that. Reading is the strict XML parser from the old .xmind files (no
DOCTYPE, predefined entities only): texts (a single-line attribute or
a multi-line block), notes (the CDATA note and the percent-encoded
attribute of the old files), links, fill and text colours, bold and
italic, shapes (box and line), folding, the map's relationships (as
relationship lines) and its free branches (as floating topics,
positions kept). The side a topic sits on comes from its position, so
a left-leaning map opens as Logic (left) and a two-sided one as a
map. Writing goes the other way (Save as .wxml and a new "Export
WiseMapping" button): the first sheet is the map and the sheets after
it are WiseMapping's free branches, with positions worked out from
the tree shape; markers keep their emoji, but priorities, progress,
pictures, per-word style, boundaries, summaries and topic links are
not carried. The format was taken from WiseMapping's own serializer
and importer, and has not been checked against WiseMapping itself.

Agent: Vibe (Mistral, glm-5-latest-short)
Relu-par-humain: Martin-PB
Martin-PB and others added 2 commits October 18, 2026 05:12
The reader drops relationships whose ends are missing, but the type
checker still saw both ends as possibly undefined and refused the
build; the filter now carries a type guard saying what it keeps. The
FreeMind gzip test also compares the two reads without their fresh
ids, the same fix the FreeMind branch already carries.

Agent: Vibe (Mistral, glm-5-latest-short)
Relu-par-humain: Martin-PB
Resolve the conflicts in files.ts (keep main's parseDocReport with the
import report and add the .wxml branch to it) and README.md (keep the
WiseMapping paragraph, main's unzip limit and the safety rule naming
WiseMapping).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G2FX9kDHnPYmocPxX3w7ov

This branch has not been deployed

No deployments
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.

2 participants