LeaVerou / md-block

A custom element for rendering stylable (light DOM) Markdown
https://md-block.verou.me
MIT License
324 stars 17 forks source link

How to handle textContent? #4

Open LeaVerou opened 2 years ago

LeaVerou commented 2 years ago

Right now, textContent doesn't do anything special, and one needs to use mdContent to re-render Markdown on the component. However, that means that <md-block> doesn't work well with libraries that handle HTML in an agnostic way (e.g. Mavo, Vue, Angular etc). However, if textContent (and innerText?) becomes an alias to mdContent, then how does one get the actual textContent of the element?

Another alternative would be if textContent sets mdContent on write, but returns the actual element textContent on read. This would allow libraries that work with textContent to update its content, but reading textContent would still work. Is there any precedent for such behavior? Is it confusing?