{"repo":"thetarnav/streaming-markdown","free":true,"listed":false,"github":"https://github.com/thetarnav/streaming-markdown","clone":"git clone https://github.com/thetarnav/streaming-markdown.git","description":"🔴Ⓜ️⬇️ Streaming markdown à la ChatGPT (WIP)","language":"JavaScript","stars":387,"topics":["html","js","markdown","chatbot","parser"],"license":"MIT","category":"ai-agents","readme_excerpt":"Streaming Markdown Experiment making a streaming markdown parser à la ChatGPT. --- Installation Install streaming-markdown package from npm. Or just copy smd.js file to your project. Or use the CDN link.\\ It's a minified (3kB Gzip) version of the package, with only the necessary functions exported.\\ See the exports in smd min entry.js .\\ The package uses ES module exports, so you need to use type=\"module\" in your script tag. Usage First create new markdown Parser by calling parser function.\\ It's single argument is a Renderer object, which is an interface to render the parsed markdown tokens to the DOM.\\ There are two built-in renderers— default renderer and logger renderer —that you can try at first. write function Then, you can start streaming markdown to the Parser by calling parser write function with the chunk of markdown string. You can write as many times as you want to stream the markdown. The parser is optimistic. When it sees the start of an inline code block or code block, it will immediately style the element accordingly. E.g. print(\"hello wor should be rendered as print(\"hello wor While the text is streamed in, the user should be able to select the text that has already been streamed in and copy it. (The parser is only adding new elements to the DOM, not modifying the existing ones.) end function Finally, you can end the stream by calling end function. It will reset the Parser state and flush the remaining markdown. Renderer interface Field name Type Description ","default_branch":null,"files":null,"tree":[],"storefront":"/r/thetarnav","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/thetarnav/streaming-markdown/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}