Skip to content

Storing of output data #311

Closed
Closed

Description

@Kuureki

Blocknote is an amazing editor, I loved the ui and how it was easy to setup but right now there's no good way for storing the output data, be it raw json, html or markdown.

  1. If you try to store in markdown there is complete loss of indentation, alignment, colors etc.
  2. If you try to store it in HTML, the output instead of using the style prop uses class prop which would definitely make it harder to adapt with custom components.
  3. Storing data in json is absolutely is no go since there's no way to actually convert it to html or markdown at a later point with utility functions.

Possible solutions -

  1. Markdown output will always have lossy output, there's no way to fix this except for using inline HTML.
  2. For HTML, it should use the style prop rather than using custom class prop.
  3. Storing the raw data can be extremely helpful if there's an way to convert the blocks to HTML without initialisation of a editor.

Activity

  1. matthewlipski commented on Aug 14, 2023

    @matthewlipski
    Collaborator

    Basic styles like bold, italic, etc should be getting serialized to HTML correctly already, but color styles and text alignment information is removed. I think fixing this would be a good improvement.

  2. YousefED commented on Aug 16, 2023

    @YousefED
    Collaborator

    Thanks @Oreki-Dev for the clear description.

    I understand that your use-case is:
    (a) you want to serialize and deserialize content to/from a database.
    (b) you want to display render the content as HTML (probably on the backend?), without rendering an entire editor on the client.

    a) is currently supported, but b) not very well, because the HTML is kind of "lossy". I think this makes a lot of sense and should be a very common use-case, for example if you use BlockNote as an editor inside a CMS - where you want to have the editor in the admin panel, and then use the HTML version of the written content for pages of the website (that visitors see).

    Let me know if we understand the use-case correctly. I agree this would require extra work on the HTML export function, and a function that can also be run server-side without loading the entire editor

    cc @matthewlipski

  3. Kuureki commented on Aug 16, 2023

    @Kuureki
    Author

    Hello @YousefED, yes you've more or less understood my use-case, I'm actually building a content platform (blog to be precise) and I would love to store the output as raw JSON but that would only be possible if

    1. It is possible to convert data from/to JSON/HTML/MD without initialisation of an actual client
    2. The HTML output uses style prop instead of class prop

    However beside this issue I've loved it and I would love to keep up with the updates and probably use it in the future as well
    Thank you!

  4. self-assigned this
    on May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions