let JavaScript in browser apply up the diff.send diff over the WebSocket connection to browser,.html by using a previous “memoized” version of. establish a WebSocket connection with browser,.on top of that, there’s a full page re-render needs to happen every time the new contents is about to appear on page.īecause in Elixir ecosystem there exist tools like earmark, phoenix_live_view and phoenix_live_reload - couldn’t the above script in node be implemented much more optimally? E.g.:.there’s some kind of delay between when the file is changed, and when the change is “noticed”,.Perceivably, the lag comes from 2 sources: This works good enough, but as the length of article grows, there’s a noticeable lag between saving the file and the contents appearing on the web page. Basic writing and formatting syntax Create sophisticated formatting for your prose and code on GitHub with simple syntax. With the above, I’m able to edit the file locally and see it’s preview in Safari. GitHub combines a syntax for formatting text called GitHub Flavored Markdown with a few unique writing features. Socket.emit('updateContent', htmlContent) I’ve largely achieved this by using a node HTTP server, with a combination of marked, highlight.js and socket.io libraries: I know this is ugly const http = require('http') Ĭonst ).value html out of it and cue browser to reload the page (see next item), a “small” server that would notice changes to the file, then render an.neovim or Zed, or even a TextEdit on macOS, Instead of using a dedicated “Markdown editor” tool for this, I’d like to use: I’ve also tried using an online “ Demo” page for Markedjs, only to have lost a couple of hours of writing when my Chrome crashed But that’s a lesson for me, I guess. (I got to be honest I haven’t check each and every Markdown editor out there)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |