Create a custom class extending MarkDecoration

I wanted to create a custom decoration class extending MarkDecoration, to associate extra information with the decoration. My use case is that I want to add some notes with the decoration, and thought it would be cleaner to use a custom class instead of the spec attribute of MarkDecoration.

However MarkDecoration is not exported by the library, which is probably by design. But wanted to confirm whether this is the case.

Inheriting from Decoration is not supported, indeed. But you can put additional data in your decoration spec object, and read it via the decoration object’s spec property.