Thanks a lot for a thorough reply. I should hav been more specific about what I meant by "not working". Yes you are absolutely correct, the class got added but the code chunk got parsed as Mathjax.
The reason why I'd like to avoid .className[] is that I am extending xaringan using, among other things some xaringanExtra features, and I want the "framwork" to be as easy to use as possible. I would like it to be used by teachers at my uni so ease of use is highly desirable.
What I need is for all code in a div of that class to be processed with echo=TRUE despite echo= being globally set to FALSE. Also, less typing is better...
So the idea was to have a chunk opt, e.g. panel=TRUE that would take care both of echo= and the wrapper <div>class. I then have some JS that uses xaringanExtra-style tabs and displays the plot in the chunk and the corresponding code in two tabs (see https://and.netlify.app/lectures/01/slides/#5)
And sure, it can be done with .class[] and echo=TRUE but that's not elegant 