How to get Zencoding to add a closing comment to d

2019-08-02 12:55发布

问题:

I had previously managed to get Zencoding in ST2 to autocomment closing tags eg:

I'd type div.my_div and hit tab and as well as creating the div, it would also add a closing comment so that I can easily navigate the closing div tags in my document.

<div class="my_div">
    *
</div> <!-- .my_div -->

Do any of you know how to replicate this?

Thank you.

回答1:

You should use “comment“ filter: http://code.google.com/p/zen-coding/wiki/Filters

.my_tag|c

You can also make ZC to automatically apply “comments” filter to HTML. It‘s a bit hacky, but you need to open zen_settings.py file and add c filter at https://github.com/sublimator/ZenCoding/blob/master/zencoding/zen_settings.py#L511

It should look like this:

"filters": "html,c"