Hi,
I am by no mean expert in JS in dokuwiki, so take my advice for what it's worth...
AJAX requests are handled by action plugins. Syntax is handled by syntax plugins. How will these 2 different components communicate ? I mean, how will you pass parsing results from the syntax plugin to the action plugin ? they are not even run by the same script. Syntax plugins are triggered by doku.php, while AJAX are run by lib/exe/ajax.php. So you'll have to store some data somewhere; maybe in the page metadata or some database of yours... AJAX puts more load on the server, and will add delay in page rendering.
You can't use JSINFO in syntax plugins (well, you could, but it would have no effect as it would be too late). JSINFO is available in action plugins. Once again, how will you pass data from your syntax plugin to the action plugin ?
the devel/javascript page states that you "should avoid mixing JavaScript and XHTML.", not that you mustn't mix them.
I'm afraid there is little choice but to inline your JS. Don't despair though, others are doing it too. For example, the very popular indexmenu plugin does that, and has been doing it for years : See the code in _jstree() called by _indexmenu() called by render() in
syntax/indexmenu.php.