developit / snarkdown

:smirk_cat: A snarky 1kb Markdown parser written in JavaScript
http://jsfiddle.net/developit/828w6t1x/
MIT License
2.29k stars 109 forks source link

simple editor as preact component #58

Closed jojo05 closed 6 years ago

jojo05 commented 6 years ago

How would you convert the simple editor example into a preact component ?

let $ = document.querySelector.bind(document); let html = snarkdown($('#in').value); $('#out').innerHTML = html; $('#code').textContent = html;

Kanaye commented 6 years ago

A really simple preact component only using preact, linkstate and snarkdown could look like this. If you want be able to use preact components from your markdown you may want to take a look at preact-markup.

jojo05 commented 6 years ago

thanks, exactly what I was looking for