ProseMirror / prosemirror-markdown

ProseMirror Markdown integration
https://prosemirror.net
MIT License
344 stars 81 forks source link

What is the recommended method to update the src/schema.ts configuration in a project? #108

Closed stephane-klein closed 1 year ago

stephane-klein commented 1 year ago

Is there a way to modify the configuration of src/schema.ts in a project?

I've tried several times without success.
I ended up copying the source code of https://github.com/ProseMirror/prosemirror-markdown/ into my project to modify here attrs: {tight: {default: false}} to attrs: {tight: {default: true}}.

Have I used the right method? If yes, what do you think to document it in prosemirror-markdown (I can propose a pull request)? If no, what is the recommended method?

Best regards,
Stéphane

marijnh commented 1 year ago

You can create a new schema from an existing one by doing something like...

let mySchema = new Schema({
  nodes: schema.spec.nodes.update("ordered_list", newListSpec),
  marks: schema.spec.marks
})

Please use the forum, not the bug tracker, for questions.