summaryrefslogtreecommitdiff
path: root/js/bin/commonmark
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2015-01-08 10:21:30 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-09 10:15:23 -0800
commite564e0af5c2f7b9732e89707655068e507579a89 (patch)
treea9908e1340ce4cf3f1bfd73d85db844151966423 /js/bin/commonmark
parent6b8f1433347557076140afb35ef4d9f036a658f9 (diff)
Use linked list instead of arrays for AST.
Use the same doubly linked node structure that cmark uses. The primary advantages of this change are (a) simplified code, especially in the renderers, and (b) elimination of the need for recursion, so we can render deeply-nested structures without a stack overflow. A node walker has also been added, for easy AST traversal. * Added js/lib/node.js for nodes. Includes a node walker. * All modules updated to use node structures. * Regularized position information into pos property. * Performance is slightly worse than before, but only marginally, and no doubt there are more optimizations that can be done.
Diffstat (limited to 'js/bin/commonmark')
-rwxr-xr-xjs/bin/commonmark2
1 files changed, 1 insertions, 1 deletions
diff --git a/js/bin/commonmark b/js/bin/commonmark
index 3c222f8..ac53e6e 100755
--- a/js/bin/commonmark
+++ b/js/bin/commonmark
@@ -14,7 +14,7 @@ var files = [];
if (process.argv[2] === '--ast') {
files = process.argv.slice(3);
renderer = { render: function(x) {
- return util.inspect(x, null, Infinity) + '\n';
+ return util.inspect(x.toAST(), null, Infinity, true) + '\n';
} };
} else {
files = process.argv.slice(2);