Skip to content

Use parsers as library (without other tiddlywiki code) #6141

Answered by Jermolene
linonetwo asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @linonetwo the parser can be reused fairly easily already just by using npm install tiddlywiki --save and something like the following:

var $tw = require("tiddlywiki").TiddlyWiki();
$tw.boot.argv = ["--version"];
$tw.boot.boot(function () {
	var text = "HelloThere this is ''wikitext''";
	var parseTree = $tw.wiki.parseText("text/vnd.tiddlywiki",text).tree;
	console.log(JSON.stringify(parseTree,null,4));
});

At the moment our npm package is 18MB, which I don't think is excessive by modern standards. As you note, to strip things back to a minimum would likely involve a lot of complexity.

As @pmario notes, #4977 should be merged soon; it is included in the list at #6086.

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
6 replies
@linonetwo
Comment options

@pmario
Comment options

@linonetwo
Comment options

@pmario
Comment options

@linonetwo
Comment options

Comment options

You must be logged in to vote
3 replies
@linonetwo
Comment options

@Jermolene
Comment options

@linonetwo
Comment options

Answer selected by linonetwo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants