Skip to content

leungwensen/xmind-sdk-javascript

Repository files navigation

xmind-sdk-javascript

XMind SDK for javascript (IN BOTH NODE.JS & BROWSERS)

Usage (see API reference for more information)

npm install xmind
var xmind = require('xmind'),
    Workbook = xmind.Workbook;

// open xmind file
var workbookFromFile = xmind.open('path/to/xmind-file.xmind');

// creating a new xmind file
var workbook = new Workbook({
    firstSheetId: 'sheet-1',
    firstSheetName: 'primary sheet',
    rootTopicId: 'topic-1',
    rootTopicName: 'root topic'
});

// saving an xmind file
workbook.save('path/to/new-xmind-file.xmind');
// or
xmind.save(workbook, 'path/to/new-xmind-file.xmind');

// output as JSON String
workbook.toJSON();

// get the primary sheet
var sheet = workbook.getPrimarySheet();
// add a new sheet
var newSheet = workbook.addSheet(/*options*/);

// get the root topic
var rootTopic = sheet.rootTopic;

// add a subtopic
var subTopic = rootTopic.addChild(/*options*/);

Thanks to

xmind-sdk-javascript is built on top of all these fantastic projects:

and these projects helps a lot, too: