How do you organize a prosemirror project?

I’m having trouble figuring out how to organize the code for our prosemirror editor.

Here seems to be the types of things that are in the project:

  • Schema
  • Node Views
  • Decorations
  • Commands
  • Plugins
    • Key Bindings
    • Input Rules
    • Paste Rules
  • External UI (e.g. Menus which I have not implemented as a plugin)
  • Markdown
    • Parsing Rules
    • Serializing Rules

I’m wondering how people organize these pieces. Do you separate them by type, or do you, for example, put everything related to links in one place.


I usually try to group pieces of functionality and all their related code (say a given node type and the commands, keybindings, and node views that allow users to work with it) into a plugin that can be easily enabled in an editor. For schema pieces or markdown parsers/serializers you’ll still have to export a node type or a schema-building helper, since those can’t be expressed in plugins, but those can go into the same file or directory.


Interesting, do you have any open source examples of this?

Not really for anything non-trivial, but modules like the gap cursor show how you can roll the different aspects of a feature (key bindings, selection management, decorations) into a plugin.