generate Emmet code from HTML

给你一囗甜甜゛ 提交于 2020-03-17 09:11:10

问题


I am talking about Emmet.io (former Zen Coding)

Is there a Javascript code or JQuery plugin that does that in reverse?

Example:

emmet('ul > li*3') => '<ul><li></li><li></li><li></li></ul>'

I wan't something like this

emmet('<ul><li></li><li></li><li></li></ul>') => 'ul > li*3'

PS: i have been googling for a while before i decided to ask here. Thank you.


回答1:


HTML.js is what you're looking for
http://nbubna.github.io/HTML/




回答2:


Okay. Lets do this way.

We have the Sizzle selector. And with the .size() I guess we might be able to achieve it.

Check this question. Seems similar: Reverse Zen Coding.



来源:https://stackoverflow.com/questions/15206411/generate-emmet-code-from-html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!