dabblet
dabblet copied to clipboard
Zen coding (Emmet)
Would be great to have zen coding inside dabblet -http://code.google.com/p/zen-coding/
+1 for Zen Coding, but it would be better to implement newer syntax: https://github.com/pepelsbey/zen-coding-snippets — see CSS.txt and HTML.txt for the snippets and http://zen-coding.ru/textarea/ for the JS demo.
:+1:
I might, if lots of people request it. So if it's something you want to see, please post here and say so.
Although I'd prefer to code some sort of generic system to allow people to use whatever such script they want.
+1 for Zen Coding, it's one of the best ways to write HTML quickly. Having it there by default would be great, 'cause it's almost become an industry standard: it's already included by default in Sublime Text 2, Espresso, and many others.
+1, must have feature.
:+1:
Pretty please!
Can anyone answer the following questions, as I don't personally use zen coding and I can't figure it out from the docs?
- Is it only for HTML generation? So it only has to be integrated in the HTML tab, right?
- Does it have a function to tell if some typed code uses Zen Coding or not?
- Is there any online demo? I can't figure out how that textarea demo on the website works at all. I type in it, nothing happens.
— ZC generates both CSS and HTML, based on snippets, see CSS.txt and HTML.txt
tr + Tab
should give you
-webkit-transition:$1;
-moz-transition:$1;
-ms-transition:$1;
-o-transition:$1;
transition:$1;
— I'm not sure, it's better to ask https://github.com/sergeche
— Go to textarea type html:5
and press Tab
- There're some CSS snippets: http://code.google.com/p/zen-coding/wiki/ZenCSSPropertiesEn — they are static, so in feature there would be something to replace them. But for start even this would be enough for CSS.
- On such questions you can ask @sergeche or zen_coding at twitter. From what I know it must be not so hard to add zen-coding to contenteditable: there is a plug-in for codemirror.
- Just press
tab
after abbreviation here or there :) It's not something that write code automatically, you must call it manually bytab
, so it won't cause any issues to anyone who don't use zen-coding, since it needs some code in abbreviation and if there are only whitespaces, then it would just use default behavior oftab
.
Oh that's very good, I guess I can include it by default then, as long as it's loaded asynchronously and doesn't block initial load. I'd only need to customize pre.onkeydown to avoid inserting a tab character on these cases.
I wonder if the guys at Zen Coding want to help with the integration.
Edit: On second thinking, this is probably a large download, so it should be loaded conditionally. So I'd better add a setting about it.
@LeaVerou, I can answer your questions and provide any help on ZC implementation. All you need is to implement Zen Editor interface in order to let ZC core know how to talk with back-end editor: https://github.com/sergeche/zen-coding/wiki/plugin-howto
- ZC is actually an advanced snippets system, used to generate structured data. It’s primary used for XHTML generation, but can be adapted to any other structured data. Basically, it parses CSS-like abbreviation into a tree and then produces output based on filters.
- Most ZC actions returns
true
orfalse
depending on if action was performed successfully. So, after you implement editor interface, you can callzen_coding.runAction('expand_abbreviation', editor, syntaxMode)
and it will returntrue
if abbreviation was expanded successfully,false
otherwise. You can also callzen_coding.runAction('expand_abbreviation_with_tab', editor, syntaxMode)
, which will try to expand abbreviation and put 'tab' if it fails. Actions are defined in https://github.com/sergeche/zen-coding/blob/master/javascript/zen_actions.js#L1009
I just checked out the implementation for codemirror and it looks kinda huge ( https://github.com/sergeche/zen-coding/blob/master/plugins/codemirror/zen_editor.js ) I most certainly can't devote that much time to this, especially now with 20+ other open issues to take care of. If anybody wants to do it, I can help. It has to be easier, as in dabblet:
- old browsers don't matter
- I've implemented read-only
element.selectionStart
/element.selectionEnd
andelement.setSelectionRange()
for setting the selection, so it should work similarly to a textarea, withtextContent
instead ofvalue
(but I can set an accessor onvalue
so it would work identically)
Also, it seems Zen Coding implements some things already in dabblet (increment/decrement) which would need to be removed from the bundled version.
+1 for Zen Coding
+1 Emmet rocks!