Here's a half-thought about the difficulties of parsing near-correct
syntax like this:
[[image:foo.jpg|thumb|Some '''valiant''' attempt at including an image
that fails because it only has one trailing square bracket.]
This is quite expensive to parse. According to current practice, we
should render this literally, except that the 'valiant' should be
rendered in bold. If text like this were to be frequently parsed, that
would add up to a lot of computational effort for not much gain -
clearly the user didn't *really* want two square brackets, the word
'image' etc.
So some possibilities:
- Detect the error at save time, alter the text to some more
parser-friendly but equivalent wikitext. eg.:
<nowiki>[[</nowiki>image:foo.jpg...
- Detect the error at save time, wrap it in some new extension/tag
like <error>[[image:...</error> or {{error|[[image:...}} This could
have some pretty good benefits (render it in red, generate a list of
errors* somewhere...)
- Detect the error at render time, and shortcut to displaying strictly
literally (ie, not attempting to parse the bolded text within). This
way at least you're only parsing it once. (Has implications for the
way some security is handled, like escaping & and < chars...)
Probably in reality slow parsing of incorrect syntax is a very minor
issue. But it was just a thought.
Steve
* I mean "generate a list of friendly suggestions to the user". Yes, I
know everyone goes ballistic at the word "error" and assumes that the
user will not be able to save error-ridden syntax. :)