The opts magic now validates against available elements
@@ -661,6 +661,19 @@ class OptsMagic(Magics):
display(HTML("<b>Invalid syntax</b>: Consult <tt>%%opts?</tt> for more information."))
return
+ # Make sure the specified elements exist in the loaded backends
+ available_elements = set()
+ for backend in Store.loaded_backends():
+ available_elements |= set(Store.options(backend).children)
+
+ spec_elements = set(k.split('.')[0] for k in spec.keys())
+ unknown_elements = spec_elements - available_elements
+ if unknown_elements:
+ msg = ("<b>Unknown elements</b>: {unknown} not registered "
+ "with any of the loaded backends.")
+ display(HTML(msg.format(unknown=', '.join(unknown_elements))))
+ return
+
if cell:
self.register_custom_spec(spec)
# Process_element is invoked when the cell is run.
