I’ve written a small tool for searching nodes and some simple manipulations like appending text or deleting nodes, mainly for the purpose of learning.
The util can be used as follows:
// Delete all text nodes contained in blockquotes $node(doc).find('blockquote').find('text').delete(view); // Append text to text nodes within blockquotes $node(doc).find('blockquote').find('text').contains('some text').append('some other text'); // Search for blocks filtered by a custom filter $node(doc).find().block().where(customFilter);
The query result contains a flat and a tree view of the resulting nodes with position information. The tree can be helpful for example when deleting nodes, so we only have to delete the root nodes.
For me this is mainly a small project in order to get used to indexes and positions etc. but I was wondering if such a tool already exists and if such a tool would even be helpful when dealing with everyday editor issues.
I’d appreciate any feedback.