{"id":4107,"date":"2011-08-26T11:14:29","date_gmt":"2011-08-26T05:44:29","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=4107"},"modified":"2011-08-26T11:14:29","modified_gmt":"2011-08-26T05:44:29","slug":"zen-coding-in-intellij-idea","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/zen-coding-in-intellij-idea\/","title":{"rendered":"Zen Coding in IntelliJ IDEA"},"content":{"rendered":"<p>Recently i Found this cool thing(Zen Coding) which is also supported by IntelliJ IDEA.<\/p>\n<p>Long story short, Zen Coding is a shorthand notation for writing HTML\/CSS, Few Examples are as Follows:<\/p>\n<p><strong>Ex-1 Writing a nested Markup Quickly<\/strong><br \/>\nNow in IDEA lets open any gsp\/html page and write:<\/p>\n<p>[html]<br \/>\ndiv#mainDivId&gt;p+h1+p.classForP (After Writing this press TAB)<br \/>\n[\/html]<\/p>\n<p>AND You Will Get&#8230;&#8230;.<\/p>\n<p>[html]<br \/>\n&lt;div id=&quot;mainDivId&quot;&gt;<br \/>\n    &lt;p&gt;&lt;\/p&gt;<br \/>\n    &lt;h1&gt;&lt;\/h1&gt;<br \/>\n    &lt;p class=&quot;classForP&quot;&gt;&lt;\/p&gt;<br \/>\n&lt;\/div&gt;<br \/>\n[\/html]<\/p>\n<p>Magic&#8230;..<br \/>\nThe Zen Code string is self explanatory and also easy to desipher after looking at the output.. \ud83d\ude09<br \/>\n<br \/>\n<strong>Ex-2 Repeating Elements<\/strong><br \/>\nNow lets try this In gsp\/html page,<br \/>\n[html]<br \/>\nli*5 (Then press TAB as Before)<br \/>\n[\/html]<\/p>\n<p>And We Will Get&#8230;..<\/p>\n<p>[html]<br \/>\n&lt;li&gt;&lt;\/li&gt;&lt;li&gt;&lt;\/li&gt;&lt;li&gt;&lt;\/li&gt;&lt;li&gt;&lt;\/li&gt;&lt;li&gt;&lt;\/li&gt;<br \/>\n[\/html]<br \/>\ni.e: li is repeated 5 times, hence multiplying with a number &#8216;n&#8217; repeates it &#8216;n&#8217; number of times.<\/p>\n<p>\n<strong>EX-3 Assigning variable Id\/Classes\/anything<\/strong><br \/>\n<strong>Note:<\/strong>Item numbering with $ character: li.item$*3 will output &#8216;li&#8217; tag three times, replacing $ character with item number.<br \/>\n[html]<br \/>\nli.item$*3 (Press TAB as Always)<br \/>\n[\/html]<\/p>\n<p>And We Will Get&#8230;<br \/>\n[html]<br \/>\n&lt;li class=&quot;item1&quot;&gt;&lt;\/li&gt;&lt;li class=&quot;item2&quot;&gt;&lt;\/li&gt;&lt;li class=&quot;item3&quot;&gt;&lt;\/li&gt;<br \/>\n[\/html]<\/p>\n<p><strong>Note:<\/strong> Multiple &#8216;$&#8217; characters in a row are used as zero padding, i.e.: li.item$$$ \u2192 li.item001<br \/>\nLets try this:<br \/>\n[html]<br \/>\n li.item$$$*3 (Tab Again..)<br \/>\n[\/html]<\/p>\n<p>And We will Get&#8230;<br \/>\n[html]<br \/>\n&lt;li class=&quot;item001&quot;&gt;&lt;\/li&gt;&lt;li class=&quot;item002&quot;&gt;&lt;\/li&gt;&lt;li class=&quot;item003&quot;&gt;&lt;\/li&gt;<br \/>\n[\/html]<\/p>\n<p>and So on&#8230;&#8230; Lots of possibilities here.. \ud83d\ude09<\/p>\n<p>\n<strong>Ex-4 Assigning class and id both together<\/strong><br \/>\n[html]<br \/>\ndiv#page.section.main<br \/>\n[\/html]<\/p>\n<p>And we will get&#8230;<br \/>\n[html]<br \/>\n&lt;div id=&quot;page&quot; class=&quot;section main&quot;&gt;&lt;\/div&gt;<br \/>\n[\/html]<\/p>\n<p>\n<strong>Ex-5: Custom Attributes<\/strong><br \/>\nlets try this&#8230;<br \/>\n[html]<br \/>\ntd[colspan=2]<br \/>\n[\/html]<\/p>\n<p>And we will get&#8230;.<br \/>\n[html]<br \/>\n&lt;td colspan=&quot;2&quot;&gt;&lt;\/td&gt;<br \/>\n[\/html]<\/p>\n<p>\n<strong>Ex-6: Abbreviation groups with unlimited nesting<\/strong><br \/>\nLets try this&#8230;<br \/>\n[html]<br \/>\ndiv#page&gt;(div#header&gt;ul#nav&gt;li*4&gt;a)+(div#page&gt;(h1&gt;span)+p*2)+div#footer<br \/>\n[\/html]<\/p>\n<p>And we will get..<br \/>\n[html]<br \/>\n&lt;div id=&quot;page&quot;&gt;<br \/>\n         &lt;div id=&quot;header&quot;&gt;<br \/>\n             &lt;ul id=&quot;nav&quot;&gt;<br \/>\n                 &lt;li&gt;&lt;a href=&quot;&quot;&gt;&lt;\/a&gt;&lt;\/li&gt;<br \/>\n                 &lt;li&gt;&lt;a href=&quot;&quot;&gt;&lt;\/a&gt;&lt;\/li&gt;<br \/>\n                 &lt;li&gt;&lt;a href=&quot;&quot;&gt;&lt;\/a&gt;&lt;\/li&gt;<br \/>\n                 &lt;li&gt;&lt;a href=&quot;&quot;&gt;&lt;\/a&gt;&lt;\/li&gt;<br \/>\n             &lt;\/ul&gt;<br \/>\n         &lt;\/div&gt;<br \/>\n         &lt;div id=&quot;page&quot;&gt;<br \/>\n            &lt;h1&gt;&lt;span&gt;&lt;\/span&gt;&lt;\/h1&gt;<br \/>\n            &lt;p&gt;&lt;\/p&gt;<br \/>\n            &lt;p&gt;&lt;\/p&gt;<br \/>\n        &lt;\/div&gt;<br \/>\n    &lt;div id=&quot;footer&quot;&gt;&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n[\/html]<\/p>\n<p>You can literally write a full document markup with just a single line. \ud83d\ude42 Awesome..<\/p>\n<p>\n<strong>Ex-7: Another Example Incorporating All we learnt \ud83d\ude42<\/strong><br \/>\nLets Try this&#8230;<br \/>\n[html]<br \/>\ndiv#page&gt;div.logo+ul#navigation&gt;li*5&gt;a<br \/>\n[\/html]<\/p>\n<p>And we will get&#8230;..<br \/>\n[html]<br \/>\n&lt;div id=&quot;page&quot;&gt;<br \/>\n    &lt;div class=&quot;logo&quot;&gt;&lt;\/div&gt;<br \/>\n    &lt;ul id=&quot;navigation&quot;&gt;<br \/>\n              &lt;li&gt;&lt;a href=&quot;&quot;&gt;&lt;\/a&gt;&lt;\/li&gt;<br \/>\n              &lt;li&gt;&lt;a href=&quot;&quot;&gt;&lt;\/a&gt;&lt;\/li&gt;<br \/>\n              &lt;li&gt;&lt;a href=&quot;&quot;&gt;&lt;\/a&gt;&lt;\/li&gt;<br \/>\n              &lt;li&gt;&lt;a href=&quot;&quot;&gt;&lt;\/a&gt;&lt;\/li&gt;<br \/>\n              &lt;li&gt;&lt;a href=&quot;&quot;&gt;&lt;\/a&gt;&lt;\/li&gt;<br \/>\n    &lt;\/ul&gt;<br \/>\n&lt;\/div&gt;<br \/>\n[\/html]<\/p>\n<p>Regards<br \/>\nKushal Likhi<br \/>\nIntelligrape Softwares<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently i Found this cool thing(Zen Coding) which is also supported by IntelliJ IDEA. Long story short, Zen Coding is a shorthand notation for writing HTML\/CSS, Few Examples are as Follows: Ex-1 Writing a nested Markup Quickly Now in IDEA lets open any gsp\/html page and write: [html] div#mainDivId&gt;p+h1+p.classForP (After Writing this press TAB) [\/html] [&hellip;]<\/p>\n","protected":false},"author":28,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0},"categories":[7],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/4107"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=4107"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/4107\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=4107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=4107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=4107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}