;(function update_tree(jsonml) { for(i = 1; i < jsonml.length; i++) { if(jsonml[i][0] === 'para' && typeof jsonml[i][1] === "string" && jsonml[i][1].match(/"/g)) { // some code } if(jsonml[i][0] === 'hr') { // some code } if(jsonml[i][0] === 'h2') { // some code } } })(tree) What the code does is to take a JsonML tree like this:
[ 'markdown', [ 'para', 'This is a ', [ 'em', 'test' ] ], [ 'hr' ], [ 'para', 'another test' ], [ 'para', '"and te fen eternte t"' ], [ 'hr' ], [ 'para', 'ert wte wet wntwet wte w' ] ] And modify the data in it. For instance, the fist if statement checks for paras with double quotes. I'll have many of these if statements, say, to check for h3, h4 tags or other HTML entities.
// do stuff, as that makes a vague question even more hypothetical. \$\endgroup\$