-
-
Notifications
You must be signed in to change notification settings - Fork 0
HAST and lit-html #4
Comments
@Hypercubed Hmmm, interesting! I never had a need to use lit-html, but have always found it interesting. Now: what is the main use case to use HAST with it? Wouldn’t HAST be too big in the browser? Can’t lit-html itself do pluggable stuff like this already? |
@wooorm It's a great question, one I'm still thinking about myself. Here are my thoughts. (I'm somewhat new to each so... FWIW). I think rehype and lit-HTML are tangental: rehype (and unified, remark, etc) consists of a series of static conversions. The content is always static and can be done as part of a prerender step outside the browser. lit-html is dynamic. It generates an HTML template (and eventually DOM) that is aware of the parts of the template that are dynamic. This allows for efficient updates of only the dynamic portions. There is no concept of plugins. Here is my contrived example. Consider this markdown: # Title
## Table of Contents
[[toc]]
## Current Time
[[current-time]] Now, the For the For each of these I'm thinking if we could write a At the end of the day, I'm not sure if this approach is any better than using straight unified plugins and custom elements. That's why I'm here soliciting thoughts. (P.S. Here is my experimentation so far: https://stackblitz.com/edit/typescript-naqxbo) |
I think this all looks amazing and makes a lot of sense!
How would that look? Maybe both have a reason to exist? |
No reason they can't both exists... in fact the unified plugins and custom elements approach works already. I see three options to use
You can see all three here: https://stackblitz.com/edit/typescript-xewcch Option #3 can get really interesting combined with what @matthewp is doing here: matthewp/haunted#31 ! |
Anything we can do on the HAST side? |
Thanks for starting the discussion @Hypercubed! |
I've been thinking about how HAST can work with https://github.com/Polymer/lit-html . Some potential ideas:
Add a click event to
li
s:Convert an elements to a timed counter:
The text was updated successfully, but these errors were encountered: