Skip to content(if available)orjump to list(if available)

Show HN: Turn Markdown into React/Svelte/Vue UI at runtime, zero build step

lelanthran

Maybe I'm not understanding, but why is this "Turn Markdown into React/Svelte/Vue UI" and not "Turn Markdown into HTML"?

I'm not seeing the value of generating React, Vue or Svelte as opposed to generating DOM components.

threetonesun

It's very silly. Given that Markdown fully supports HTML I have built sites using just Markdown + web components but that's... just how it works.

What's really needed is a better editor experience.

didgeoridoo

Nice discussion on this here just a couple weeks ago: https://news.ycombinator.com/item?id=44865997

randomtoast

> Maybe I'm not understanding, but why is this "Turn Markdown into React/Svelte/Vue UI" and not "Turn Markdown into HTML"?

It's very simple: the post had not been upvoted to the front page with the title you suggested.

jy14898

It tickled me seeing the streaming example, thinking about how much better HTML deals with streaming

yaoke259

html does not allow for event handling, this allows for secure listening of the events at runtime, which afaik is not possible with html

mpalmer

Modern frontend frameworks wouldn't exist without JS events, not the other way around. You can absolutely do this with vanilla HTML+JS.

https://developer.mozilla.org/en-US/docs/Web/API/Event

yaoke259

Svelte, React and Vue allow for easier event handling, at least that was my rationale, is it possible to achieve the same with html?

lelanthran

> Svelte, React and Vue allow for easier event handling, at least that was my rationale, is it possible to achieve the same with html?

I'm not really sure how Svelte, React or Vue allow for easier event handling. I mean, what's harder with standard events in Vanilla JS? Sure, it's not perfect, but what exactly is easier in Svelte, React and Vue that makes the trade-off with VanillaJS a reasonable one?

Some more questions, if you don't mind:

1. I see that the event interface specifies detail with `id` and `value` fields. What is the reason for using this? The underlying event already has a target, which will have the id and the value fields anyway. Are the widget's in this system so different that they have different id fields to the DOM elements?

2. There does not appear to be a field in the emitted event for the event sub-name (other than the custom name in the event structure itself). What if a component needs to emit something other than a "click" event? Ordinarily we'd get the event name from the event itself, so the handler knows whether it is being called on "focus", "click" "activate", etc. This information is lost with a custom event.

3. I'm still confused why you can't emit DOM elements; I mean, if you said "can't do two-way data binding" or something along the similar lines, it'd (maybe) make sense, but your response makes me think that you have not even considered it. I feel, maybe wrongly, that this library is both unnecessarily crippled and over-engineered - it targets spaghetti-as-a-pattern React, but not the hierarchical DOM?

yaoke259

Thanks for the questions and super valuable feedback! To be totally honest, I came from a Svelte/Framework background and just did not deeply consider/realise you can create a pure dom version and event handling with just plain js. It's definitely a valid point that I'll take into consideration into designing the next version. Currently it does seem a bit overengineered since the React, Vue and Svelte implementations are actually all wrappers over web components, and still potentially offer some (potential) advantages in advanced state management which I have not yet explored. I'll definitely look into this more deeply.

thrown-0825

keywords for search optimization

ekusiadadus

I actually tried it out and it feels pretty good. Especially with SvelteKit, where the library ecosystem is still somewhat limited, a library like this is really exciting. I particularly love that it works at runtime, since implementing that myself would be a hassle—so I really appreciate it.

yaoke259

thanks!

yaoke259

Seems like some people are confused by the design decisions of using React/Svelte/Vue and using it at runtime. The use case I had in mind was LLM interaction, which you can try in the Chat Demo (running a real llm btw!). LLMs require secure, runtime, and minimal DSL to generate interactivity, hence markdown-ui.

mike_hearn

It's very cool and the fact it has a spec is the icing on the cake. There could easy be implementations for other runtimes. Probably, given the spec, an LLM could generate such an implementation.

yaoke259

thanks!

Tade0

For me it stops working after several clicks.

The other day my project owner remarked that in the future perhaps we won't be building catalogs of items like the one I am currently, but interrogate an LLM assistant for a summary of the data - no need for forms and such.

I don't know how accurate that prediction is, but it got me thinking: what if coding assistants are a dead end and what users will actually prefer is going to be just a text box where you type in your human-language query?

Forms are here to stay at least in any kind of government or legal document, as there's liability associated with any mistakes, but less consequential stuff?

freetonik

>For me it stops working after several clicks.

This has been my experience with many rich web apps in the last several years. I have a habit of pressing Cmd+R especially before doing something important, and it feels like rebooting a computer in Windows 95 days.

yaoke259

This happened after I turned the demo site into Astro to demo all the frameworks at once. For some reason it messes with the hydration of the site, will keep debugging...

mirkodrummer

We will then build LLMs hooks for letting the AI output a rich version of the summary data, aka an html table first and... here we go again ;) It could build his own table but it won't be what the x customer wants/needs. Anyways I don't believe the prediction in the first place because LLMs are lossy compressors(even RAG), form masks over structured data are loss less.

friendzis

Yes and no. Natural language processing querybox will be one of the interfaces for two reasons: some people already (still?) associate that with trustworthy search, however since it is like "I'm feeling lucky" button it is perfect place to hide paid advertisements. On the other hand, your PO dismisses the value of windowshopping and I don't see good catalogs disappearing anytime soon.

cluckindan

That’s nice for the easy stuff, but forms for any real application always have conditionally visible/required/disabled inputs/options/fieldsets.

null

[deleted]

yaoke259

I have fixed the home page bug, apologies

AbuAssar

I saw this coming as there is a need for a DSL that targets LLM-first and that it will be made in the near future.

and here it is

yaoke259

yes, very interesting area to be explored further

chromehearts

I'm having trouble with some widget elements not registering events properly, especially the checklists.

Still looks like a solid tool tho in my opinion

yaoke259

thanks :)

eashish93

streaming not good and smooth. You should check out streamdown.ai

_heimdall

Svelte, react, and vue all require a build step if I'm not mistaken. What's the value in delaying markdown transformation until runtime?

snickerdoodle12

Only if you're using jsx

yaoke259

so runtime use cases like LLMs can be supported, in the Chat example you can interact with a real llm!

whalesalad

You can just include Vue on a page and go to town, no build step needed.

archerx

The lengths that people will go to just to not write HTML...

codegladiator

> ```markdown-ui-widget { "type": "button-group", "id": "plan", "label": "Plan", "choices": ["Brainstorm", "Review", "Launch"], "default": "Brainstorm" } ```

      markdown-ui-widget-html-version-long
      <button-group id=plan label=Plan choices="Brainstorm,Review,Launch" default=Brainstorm />

yaoke259

I designed it this way to be more markdown like, and without support for styling