jupyterlite-sphinx icon indicating copy to clipboard operation
jupyterlite-sphinx copied to clipboard

validate/parse example_class (and height)

Open Carreau opened this issue 5 months ago • 1 comments

I think it would be good to validate early the config options example_class, and height, mostly to fail early.

I'm thinking that it's easy for someone not knowing css to do thing like include a space, or a dot (.), which will most likely make the ccs wonky. I guess it is also good to protect against ay character that might break the HTML, like slashes/backslashes and angle bracket. I again doubt they would be but there on purpose, but one never know.

Validating classname should be straitforward, but Validating height is I think a bit more complicated as there are way more valus that can be taken, including things using calc() and expressions: https://developer.mozilla.org/en-US/docs/Web/CSS/height

Carreau avatar Jan 31 '24 08:01 Carreau

This could be useful in some cases but I don't think it's that important for TryExamplesDirective. I think most users should use autodoc with global_enable_try_examples = True, and not bother with adding the directives manually. In any case, I think all of the jupyterlite-sphinx directives have a height option and haven't had this kind of validation. I don't think it's worth going through the trouble honestly.

steppi avatar Jan 31 '24 18:01 steppi