To help users debug their BBCode markup and to generally enhance the level of error feedback, I've been validating the params
and content
in the openTag
function of my tag specifications.
Here's an example of what I've got working:
Did you ever put any thought into this kind of feature?
I haven't studied your code too much yet, so until I figure out how it works, I threw some global state at the problem and wrote some regretful code: https://gist.github.com/danneu/f5b8b58b87b828b708bb
Obviously that's nasty and this certainly isn't a solution proposal, but it's an example of the kind of validation that would be nice to do.
As for a real solution that might be trivial, one idea off the top of my head would be to be to support an optional property on tag specs:
openTag: ...,
closeTag: ...,
// Returns String (err message) upon validation failure, else returns falsey
errorCheck: function(params, content) {
if (!params) return 'Missing color parameter';
}
Any ideas? Either way, I'll see what kind of abstraction I end up with once I start refactoring my mess.
Also, I know this is an old project of yours, and it's possible that BBCode and this repo aren't at the forefront of your mind these days like it was back when you wrote it.