ConvertKit / slate-plugins

A collection of plugins for SlateJS, maintained by ConvertKit
https://convertkit-slate-plugins.netlify.com/
MIT License
52 stars 22 forks source link

Replace JSX with tagged template literals #13

Open brendancarney opened 5 years ago

brendancarney commented 5 years ago

This provides a few benefits:

Here's a potential API. The naming will almost surely change as I don't like it right now.

const structure = {
  blocks: {
    paragraph: "paragraph"
  },
  marks: {
    bold: "bold"
  }
}  

const { editor, html } = SlateTest({ plugins: Code() }, { structure });

const value = html`
  <paragraph>
    Some sample <bold>text</bold>
  </paragraph>
`

A few open questions:

brendancarney commented 5 years ago

Added https://github.com/ConvertKit/slate-plugins/tree/master/packages/slate-htm to potentially make this happen.

brendancarney commented 5 years ago

After writing many tests for Slate code here and in other repositories, I'm convinced this is the way to go now.