Learn to be a Zen master of markup

The markup, or markup, refers to markup or tagging languages ​​as they are HTML and CSS, and we all know how painful all this is to open and close labels one by one to create a web template ...

Of course there are solutions for this, one of them is autocompletion with IDE's like Dreamweaver mierda bluegriffon annoying if you don't buy plugins from him o komodo edit very heavy… The point is that IDE's or code editors too loaded with options often end up hindering the work in unimaginable ways; such is the case of Dreamweaver that fills you with garbage code what you generate graphically and is heavy, expensive and ugly. bluegriffon it's mostly annoying because it's free, free, but half of the options are reserved for paid users ... that's not fun. And finally we have komodo-edit, which is quite good, powerful and full of options but it is heavy (100mb in iddle) and setting it up is tedious.

The best weapon of a web developer or web designer is not the IDE's in the style of war tank with a thousand weapons on top, it is a simple text editor, some plugins and the ability to type like a sick person ... to that add the magic of zen coding and they will have in their fingers the best tool for marking ever created (at least for me).

But ... what the hell is the zen coding?

Simple, it's a special plugin that serves as a drop-down abstraction layer for HTML and CSS created in javascript and available to many of the most famous publishers (notepad ++, Komodo-edit, Gedit, Kate, Bluefish, Geany, Dreamweaver, Etc.).

Aha, I still don't understand a damn idea what you're saying ...

So I show you with a simple example; Remember the drop-down abstraction thing? Well, change it to shrinkage, imagine you can take a line of HTML / CSS code collapsed into one line and unfold it like a curtain or fold it back ... Want to see how? You just have to make sure you have two things to make it work:

Having zen coding installed in your editor.
Know the commands and syntax to use it.

Okay, fingers to the code:

html>head+body

See that line of code? Well that's the syntax for HTML, it's simple:

First you put the name of the tag (html) then you indicate which tags are going to be inside that tag (>) and then the name of the tags that go inside that tag (head and body). The '+' sign indicates that head and body are two different labels and that neither is contained within the other, it's like saying «together but not mixed«… Then, let's see what that line of code generates when pressing the magic keys (in my case CTRL + E):

Exactly, 4 lines of code made into one, that magically appear when you press the correct key combination… and there can be many more; for example:

html>head+body>ul#lista_ordenada>li.listilla*5

Same syntax, but we add something else… if you know something about CSS you will realize that we are adding an ID, classes and, something that you surely did not know; multipliers… what's all this !? Fuck you confuse me!

Calm down, this is quite simple, we told the above that inside body enter a tag «ul», nothing strange, I explained this above, then, we assign an ID, that if you know CSS you will understand that these are identified with the sign '#', and inside that unordered list (ul) we add five labels with the class (class) listilla, I briefly explain this. In fact it is very simple, '#' denotes that it is an ID, then 'li.listilla' says that we have to create a label «li» with the class listilla «li class = listilla» and then, we say «repeat that last five times«. What gives us as a result:

Twelve lines of code written in a single line and in much less time 😉

And that can also be done with CSS, although I will not lengthen the article by showing the obvious (below I will pass you a whole list of cheats for zen coding).

I have to emphasize that this does not work to make a zillion hundred thousand lines in one, oh no, this has a limit and a way to use it. If for example we want to do something like this:

html>head>title+meta+body>ul#lista_ordenada>li.listilla*5

What in theory should give us this (look at the highlighted line in the last image):

It will give us this:

Which shows that you can't do magic with this either; Remember that a Zen master of the code must be precise and fast, and doing things wrongly done takes speed and time, therefore, the correct technique to write quickly and with zen coding would be this:

html>head>body>ul#lista_ordenada>li.listilla*5

You expand and inside the head tag:

title+meta

Which would give you the correct code:

Although the zen coding It has many more things to show you and maybe having to write another command line inside head is not the best, so we use another command, «expand with abbreviation" in my case ctrl + alt + e which will open a small bar where we can write Zen code and see how it appears in real time. Be careful, I do not recommend writing everything with this but writing within the structures already created, I mean, first create the large structures and then you will detail within them with this option.

And there are a multitude of super cool commands within the zen coding, the thing is that you investigate them once you install them and learn to use them; With this plugin you will not need autocompletion or snippets for css or html, in fact, with this you will realize that these options are a total waste of time within these two programming languages ​​😉

And for those interested, here is the official CheatSheet of the zen coding, you can see it in format ODF o PDF fair HERE


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Mafuns said

    I find it super interesting!

    I'm going to try it for sure!

  2.   Mafuns said

    One question, shouldn't the "head> body" form create body inside head? To get what we want, shouldn't we put "head + body"?

    If I'm confused I'm sorry!

    Thank you

    1.    dwarf said

      Yes, any tag name preceded by a ">" indicates that it goes within the previously named tag; in this case, as you say, head> body indicates that body would go inside head, which we know is incorrect.

      And yes, head plus body is like concatenating, you tell it that they go inside another tag but that neither of them goes inside the other, in this case html> head + body

  3.   assuarto said


    Amen

  4.   103 said

    Very, very good, personally I prefer to use plain text editors for this kind of thing and Zen Coding as it is the best I've seen for HTML.

    I really liked this: html: xt and for those who want to anticipate htlm: 5

  5.   auroszx said

    Hmm, well I've never really used Dreamweaver-like programs, I have to try this Zen Coding ...

    PS: That wallpaper you have… is it by chance the one I made?

    1.    dwarf said

      Yes but the one DesdeLinux

  6.   Ezeel said

    Very good, I have always liked lightweight text editors, the one I use now is geany and seeing that it is supported for the magic teapot surely encourages me to try it

  7.   Lupin III said

    Well, programming is not my thing, what has blown me away has been the desktop, what do you use, gnome 3 or unity, what is it? It is very very cool, to see if I leave mine similar
    If you don't mind answering me, I would be very grateful 😀
    PS: yes, I am from windows, it is what the University has xD

    1.    dwarf said

      Unity, with the elementary theme and lower the opacity of the panel.

      1.    neomyth said

        I also work with windows, let me congratulate you on your desktop is very cool.

  8.   jaszandre said

    The article is very interesting ... I see it very useful. By the way, the installation of the Zen Coding plugin for Gedit caught me somewhat by surprise and that is that you have to download the appropriate package for Gedit3. The official Zen coding site offers the links to the plugin for Gedit, but it is outdated as it is for Gedit 2 which makes it impossible to use it in the current version of Gedit3 according to the installation instructions.

    Gedit plugins written for version 2 do not work in the new version 3, as it uses GTK3, while Gedit2 uses GTK2. To use a plugin in Gedit3 you have to take into account the following:

    New Directory: ~ / .local / share / gedit / plugins
    The .gedit-plugin extension must be renamed .plugin
    Open the file and edit the [Gedit Plugin] header, and change it to [Plugin]
    Also change IAge = 2 for IAge = 3

    Those who use Gedit3 can download the Zen Coding plugin from the link below:

    https://github.com/mtrovo/zen-coding-gedit3

    I hope it will be you useful.
    Greetings.

    1.    stern said

      THANK YOU, I had exactly that problem !!

    2.    alex-m7 said

      Excellent you hit the problem I had! GRAX!

  9.   elynx said

    Very useful, although for this edition in html or any web-oriented language and others I prefer BlueFish or Aptana Studio.

    Regards!

    1.    dwarf said

      Bluefish fails in a couple of things like being able to customize keyboard shortcuts and stuff, and that to this day I can't make the quotes autocomplete, and that takes a lot of trouble out of me for later forgetting to close a couple.

      Aptana, it just sucks for me, it is simply written in Java and has dependencies that endanger my system ... not to mention that for me (understand very well, FOR ME) Java = shit.

  10.   v3on said

    I've been using it for a long time, recommended!

  11.   Rafael said

    Hello, exelene article ...
    I don't want to feel like a Zen master :-), but the expansion you propose:

    html> head> title + meta + body> ul # ordered_list> li.listilla * 5
    (that fails to expand)

    it can be done correctly with parentheses to group, something like this:

    html> (head> title + meta) + (body> ul # ordered_list> li.listilla * 5)
    this expands as expected

    regards

  12.   Felipe said

    this plugin is discontinued and was replaced by emmet (http://emmet.io/)

  13.   Ulises said

    Does anyone know how I install it in Archlinux for kate? Thank you.