This one is a bit niche, even by my usual standards, but if you're interested in strategies for DOM transformations, rich text editing, or EPUBs, maybe this is for you!
This one is a bit niche, even by my usual standards, but if you're interested in strategies for DOM transformations, rich text editing, or EPUBs, maybe this is for you!
Nice explanation! I came up with a vaguely similar design for converting paragraphs that I want to quote from HTML to Markdown. My bookmarklet uses a RichText class that contains a text string...
Nice explanation! I came up with a vaguely similar design for converting paragraphs that I want to quote from HTML to Markdown. My bookmarklet uses a RichText class that contains a text string that’s annotated by contiguous spans with marks. Since it works one paragraph at a time, handling multiple nodes like ProseMirror wasn’t needed.
This is also how Bluesky represents rich text within a post. See here.
Nit: I think there might be a typo in one of the mappings in the article? “1 → 0, 2 → 3, 3 → 2” seems wrong because it seems like the positions both before and after the mapping should be in order?
Thanks! And thanks for that Bluesky link, that is interesting. I think that's similar to how Swift represents rich text, as well. Oh, yup, you're right. That should be 2 -> 1, not 2 -> 3! Thanks...
Thanks! And thanks for that Bluesky link, that is interesting. I think that's similar to how Swift represents rich text, as well.
Oh, yup, you're right. That should be 2 -> 1, not 2 -> 3! Thanks for noticing, I'll update in a minute!
This one is a bit niche, even by my usual standards, but if you're interested in strategies for DOM transformations, rich text editing, or EPUBs, maybe this is for you!
Nice explanation! I came up with a vaguely similar design for converting paragraphs that I want to quote from HTML to Markdown. My bookmarklet uses a RichText class that contains a text string that’s annotated by contiguous spans with marks. Since it works one paragraph at a time, handling multiple nodes like ProseMirror wasn’t needed.
This is also how Bluesky represents rich text within a post. See here.
Nit: I think there might be a typo in one of the mappings in the article? “1 → 0, 2 → 3, 3 → 2” seems wrong because it seems like the positions both before and after the mapping should be in order?
Thanks! And thanks for that Bluesky link, that is interesting. I think that's similar to how Swift represents rich text, as well.
Oh, yup, you're right. That should be
2 -> 1, not2 -> 3! Thanks for noticing, I'll update in a minute!