Show HN: I made an open-source Notion-style WYSYWIG editor
novel.sh
novel.sh
Like I have something that I got working in 3 days with multiple pages, so links between things, and cursor syncing (most of this work is provided by wonderful people with full-featured libraries!). There's some trickiness with how Y.js actually works (in particular map ID conflict resolution meaning you don't want a dictionary of page names to pages but UUIDs and then some sort of manual revision checking....). But you can get that and probably with a bit more work get ~instant search and the like. All with free offline capabilities.
Of course then I stared at this and was like "I like notion because it looks nice" (I personally don't care about the AI stuff or the database stuff), so just went and paid for notion for my family usage.
So I’ve started working on https://www.blocknotejs.org to make this even easier for developers; its a batteries-included library with Notion style UI elements out of the box.
Definitely bullish on this ecosystem including Yjs and local first dev!
But my requirements are pretty loose
In the end I have just been stuffing the data structure directly into postgres “as-is”. I think there are some tricks you can use to shrink some historical data but I think it’s pretty straightforward if you get to a size where the data size matters
For me, I had a pre-existing note-taking app so there were tons of documents stored in html format. So I had this challenge where I had to read them from html, convert them to yjs, then sync the changes back to the DB in html format. It was kinda tough.
FWIW I picked up prosemirror because I have experience working with CodeMirror 6, and I trust the general model to be right, if complicated to use. But honestly I might not need the level of complications provided by PM.
> BlockNote is built for React and exposes easy-to-use components. However, it is possible to use BlockNote with other frameworks or Vanilla JS (advanced users).
Y.js sounds amazing – gonna have to look into it! Have been using Liveblocks for real-time data stuff, the DX is a breeze to work with!
yrs initially looks tempting but it's unsound at it's core. (The plan is to port the API directly from JS, use unsafe to silence the borrow checker, then gradually fix specific instances of undefined behavior if they cause actual real world issues.[1] I don't this this is an approach that can work. That's a shame because a lot of impressive work has gone into yrs.)
First of all, apologies for the typo lol, apparently I can't spell "WYSIWYG" :')
Some context: I've always been a huge fan of Notion's editor, and since Vercel launched the AI SDK yesterday (https://sdk.vercel.ai/docs), I decided to take this as an opportunity to recreate Notion's block editor + incorporate some of Notion's latest AI features with `npm i ai`
Here's basically how it works:
1. Tiptap Editor setup with custom slash command extension 2. `useCompletion` hook at the parent editor + the slash command menu – using `id` to share states 3. `/api/generate` route to stream responses from OpenAI
Novel also handles image uploads via drag & drop / copy & paste. Images are stored as base64 strings in localStorage currently, but I'm planning to implement uploads to Vercel Blob in the future.
The code is fully open-source – feel free to check it out: http://novel.sh/github
Hope y'all like this – let me know if you have any feedback!
To generate the image, I simply cloned the provided github URL and used the nextjs Dockerfile[1] and removed all of the cruft. The Dockerfile is available here[2].
1: https://raw.githubusercontent.com/vercel/next.js/canary/exam...
I'm making a low-JS site, but it also has a lot of input fields, user content generation, etc. In "modern CSS" i feel like Input boxes should be better than they are. Is JS the only way?
In general, :has and :user-invalid are new and can be useful styling forms.
I see so many huge JS beasts with WYSIWYG features that i'm unsure what advancements, if any, have been made for CSS to provide something nice. Something that a user would feel it's more than nothing done at all.
The HN box feels like nothing at all. Just a plain HTML input text area.
The other thing is content editable allows all kinds of garbage to be pasted into it included any kind of inline style.
Now I maintain a fork of Htmlawed which can do a pretty decent job of filtering down arbitrary HTML into a safe and restricted subset but with no JS there can be a huge disconnect between what the user sees in their editor and what appears as the sanitized output.
As a result I’m currently using SlateJS as a rich text editor foundation. I’ve used others in the past but this is the nicest so far.
However, most people who disable JS are probably fine with not using rich text and definitely shouldn’t expect it. Just add a CSS stylesheet which turns <textarea> into something half-decent, put a note that markdown is supported, and make a plain text editor.
Any examples that you can think of which make a plain text area half-decent? So many sites go with heavy-JS options that i'm not sure what is possible for a good (half decent) visual editing experience in just CSS
Also, focusing on CSS first means - hopefully - that the UX is "as good as it gets" for JS-less individuals. If i add a small JS framework on-top of that it's likely fine.
edit: I'm sort of experimenting with how good i can make modern websites. Both on UX, accessibility, low bandwidth (folks on satellite connections appreciate this), etc. I'd like the site to "look like any modern site" (minus obtrusive crap), but suffer as few flaws as possible.
It's bit harder to do correctly manually just because of cross-platform browser quirks, you'll probably at least want normalize.css or CSS Reset. Even MDN docs has a half-decent textarea in 20 lines of CSS: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/te... (it looks ugly with monospace but change the font and I think it looks great)
If you're not going with prosemirror or similar off-the-shelf component, then this is the only way to not annoy your users. Augment it with a side-b-y-side RO view of the rendered markdown.
I mean, even the linked page is a confusing UI: you enter `**` for a bold sentence, and then when you arrow-left to the beginning of the sentence you cannot delete just the `*` you typed in.[1]
[1] I feel a better way to do this would be to not allow markdown to actually be typed in, so that the user never sees it. This sidesteps the confusion when trying to remove just the markdown. Let the user use shortcut keys and/or buttons on selections, because to remove a formatting rule they simply repeat what they did to create that rule.
I just mean .. average users. Where a text box has some very limited features that may be thought of as the baseline, the standard, etc. Not even sure what qualifies as that, but i imagine a lot of users expect to be able to highlight text and make it bold, italics, etc.
I love markdown and want to support it as the primary interface.. but i don't want to solely force it. I'd love a really, really thin layer of JS which just gives in-line highlighting for markdown, for example.
I might try to make it honestly, if i can't find it. But that's a long ways down the road.
To appreciate the difficulty and nuances with building a text editor on contenteditable, I would read through the commit history on ProseMirror https://github.com/ProseMirror/prosemirror-view/commits/mast...
I feel like if you’re targeting a no-JS crowd, that’s a very specific crowd, i.e. this one.
Regardless this is all just an exercise for me because, frankly, i hate most websites lol. The ones that look good also tend to be slow. The ones that are fast look like they're from 1990. There has to be a middleground, right?
I love that feeling of visiting some (very few) sites and they load so fast you have to double-take. I want to be that site. I want accessibility to be forefront. etc
We'll see how far i can get. I'm just a humble backend dev hah. But the site being 95% plain HTML is a good start, at the very least.
Old site.
- Built with Gatsby, hosted on Netlify.
- Lots of client-side JS, but page loads are instantaneous because everything is prefetched and a page load is a client-side JS event not a server request.
- https://v4-johnnydecimal.netlify.app/
New site.
- Built with Astro, hosted on Netlify.
- Zero client-side JS, but each page load is a good ol’ fashioned HTTP request to the server.
- Pages are small. After caching my web fonts, each page is single-digit kilobytes. This is deliberate, I worked hard to achieve this.
- It doesn’t feel as fast. Because it isn’t. Because it can’t possibly be.
Pure HTML document editor. Open source, PWA, based on TinyMCE, with CSS and markup editing, JS macros, saves to local drive, plus OpenAI integration if you have a key.
- I was about to tell you that there really should be a demo, but just now I realized the "World Wide Web Phase 2 Begins Here" button links to the demo. You really should change that text to "Live Demo" or something more clear.
- The demo itself takes a long time to load and seemed to refresh multiple times
- The GitHub should also have a link to the demo, and an image would be nice as well
- The landing page is very ugly. Any generic template would do better and inspire more confidence.
- Why not highlight some of those features you mentioned on the landing page?
Best of luck! The features sound great.
But good feedback all around, thanks!
Notion seems to be the only player in the space that effectively uses its tables as linkable databases, most similar products seem to either lack table functionality or they're just simple formatted text.
So much of my daily work revolves around databases and Excel, I would love the ability to have multiple views of database tables embedded in a text editor, varied by context, with full backend control over the database itself. Bonus points if I could easily have scripts run on them in the background, almost like a programmatic kind of Excel.
I should take a moment to clarify that I'm not affiliated with Microsoft or any of the links I'm posting here in any way. I make a living building web sites and as mentioned above, many of them leverage SharePoint. I find it a pretty easy way to build intranet solutions for my customers.
Assuming you've got your SharePoint site created within SharePoint Online, creating a "List" is pretty simple. Here's an article from Microsoft explaining how to do so: https://support.microsoft.com/en-us/office/create-a-list-0d3.... Think of a list as a database table. From there you can create various types of columns including "look-up" columns, which are basically joining to another table on the same site with a foreign key.
I think from there you could dive into the Power Platform, but there's so much out there, I think this would be a good start.
I've always thought SharePoint was terribly slow, but that was just from experience interacting with the web interface itself. Does the API perform well? Or is there that same inherent latency to put up with?
And do you have any general tips/ideas/learnings to share about using SharePoint in this way? I definitely want to give this a try.
It actually has an editor that looks eerily like the linked one so I wonder if they’re related. It lets you use slash-commands that’s much more expressive than everything except maybe notion. But again, it lets you operate against a database-like set of objects.
I don’t think you can point it at real databases though.
AnyType.io
What I miss (but not enough to change) is the ability to have a plain Markdown page, and not only rely on bullets.
But again, Logseq is by far the closest to my style of taking notes (short, usually one/few lines blocks)
This. So much this. I prefer Logseq's UI over Obsidian's but the lack of support for plain (non-outline) text files made me switch to Obsidian in the end.
It has far more data power than Coda, with tables that can be used as databases, a strong formula language, and loads of other nifty features. Like Notion, it's a closed-source SaaS.
The italics are mine. Pretty good.
Thanks for playing around with Novel!
The link describing the infra[2] is an example of how it looks.
[1] github.com/outline/outline [2] https://docs.getoutline.com/s/hosting/doc/requirements-ULdYn...
https://platform.openai.com/docs/model-index-for-researchers
I wasn't able to get the AI completions to work with my OpenAI API key; not sure why.
I don't completely understand how I'm supposed to use this as a stand-alone deployment if I can't create more than one page. I think the answer is just that the project is young, but I'm not certain.
So the question was likely: how to write the word "C++" in your prose (as opposed to writing some C++ code)
Here's the code for it: https://github.com/steven-tey/novel/blob/main/ui/editor/inde...
I've debated between "++" vs "+++", but settled for ++ since it's lesser keystrokes (at the risk of conflicting with more common words/phrases) haha
I am using obsidian on the Mac, but on the go I have no real solution. (I want to avoid using the obsidian mobile app because it forces you to use Obsidian Sync)
It's a web version of the Logseq software, it can import a local folder of MD notes.
How so? I use Obsidian on both my laptop and my phone and sync my files using Syncthing. You could probably also use Dropbox something.
But I ended up scrapping it because it was a bit too noisy. Might add it back as an optional checkbox tho!
Here it is: https://github.com/steven-tey/novel
Just curious.
https://github.com/steven-tey/novel/blob/62d32be43dae8aa40fa...
...and has a 50-request limit per day.
https://github.com/steven-tey/novel/blob/62d32be43dae8aa40fa...
...and trims the content to, um. 500 characters?!
https://github.com/steven-tey/novel/blob/62d32be43dae8aa40fa...
So past a certain point you'll get the same completion repeatedly / a completion of the start of your document, cut off.
[1] https://github.com/steven-tey/novel/blob/62d32be43dae8aa40fa...
Wish, it doesn't rely on any framework and can be plug & play with other frameworks.
I tried using your tool for it.
"WYSYWIG is an acronym that means++"
...
"What You See Is What You Get."
:thinking:
A WYSIWYG editor is an editor that shows the text with all formatting, exactly how it will look once it's "printed". You know, like Word or Google Docs. But unlike when you edit markdown or latex in a plain text editor. For example, writing comments on this site isn't WYSIWYG.
‘<<>>’ indicates where I typed ‘++’ and the resultant text is unedited.
It seems as though the AI response became “stuck” on a theme, and my renewed prompts were insufficient to cause it to change / reconsider context. . .
_____
Novel is a Notion-style WYSYWIG editor with AI-powered autocompletions.
what backend is used for the autocompletions in Novel?
The auto completions in Novel are provided by <<>> The auto completions in Novel are provided by a sophisticated backend powered by state-of-the-art AI algorithms.
These start-of-the-art AI algorithms rely on underlying technology from <<>> leading natural language processing (NLP) frameworks such as OpenAI's GPT-3 and BERT. These frameworks have been trained on vast amounts of text data to have a deep understanding of language patterns and context. By leveraging the power of thesed on massive amounts of text data and are capable of generating high-quality and contextually relevant suggestions for autocompletions. The backend of Novel leverages the power of these advanced NLP frameworks to enhance the user experience and provide accurate and helpful suggestions
Novel is funded by <<>> d on vast amounts of text data to understand and generate human-like text. The backend infrastructure of Novel leverages the power of these pretrained models to provide accurate and contextually relevant autocompletions. The sophisticated algorithms in the backend analyze the input text
How is Nobel funded <<>> d on vast amounts of text data and have achieved impressive results in various NLP tasks. The combination of GPT-3 and BERT allows Novel to generate highly accurate and contextually relevant autocompletions for users. The sophisticated backend continuously learns
what does novel cos <<>> d on vast amounts of text data to generate high-quality autocompletions. The sophisticated backend in Novel leverages the power of GPT-3 and BERT, combining their strengths to deliver accurate and contextually relevant suggestions. With GPT-
It appears to be <<>> d on vast amounts of text data to generate highly accurate and contextually relevant autocompletions. The backend infrastructure of Novel leverages the power of these NLP frameworks to process and analyze user input, allowing it to generate intelligent suggestions in real-time
What if I want to write about <<>> d on vast amounts of text data, allowing them to generate accurate and contextually relevant suggestions. The backend of Novel utilizes a combination of these NLP frameworks to enhance the autocompletion capabilities. With GPT-3, the system can generate coherent
start a new topic <<>> d on vast amounts of text data and have the ability to generate coherent and contextually relevant suggestions. The combination of GPT-3 and BERT allows Novel to offer a highly intelligent and accurate autocompletion feature to its users. The backend architecture _____