Emmet overwritten snippet - html

I have been following the lessons on HTML and CSS provided by Jeffery Way on Tuts+:
http://learncss.tutsplus.com/
I got to the video on Zen Coding:
http://learncss.tutsplus.com/lesson/zen-coding/
I tried installing Zen Code to Sublime Text 2 but couldn't get it to work. I looked around on the web and found Emmet, which seemed like the new best thing. So I installed through the Command Pallete>"Package Install">"Emmet". It works great, the only issue is a snippet I used before is overwritten by Emmet.
The Snippet I used:
<snippet>
<content><![CDATA[
<li type="square">${1:Item} ${2:}
]]></content>
<tabTrigger>li</tabTrigger>
</snippet>
li + Tab would trigger:
<li type="square">
Is there a way for me to add this to Emmet in Sublime Text 2? Or use Emmet to accomplish this tag? I found this guide to Emmet tabtriggers, but could not find this one:
http://docs.emmet.io/cheat-sheet/

You can either create your own snippet in Emmet:
http://docs.emmet.io/customization/snippets/
http://docs.emmet.io/abbreviations/types/
...or disable li snippet from being handled by Emmet:
https://github.com/sergeche/emmet-sublime/blob/master/Emmet.sublime-settings#L55
...or disable Emmet tab trigger and use Ctrl+E:
https://github.com/sergeche/emmet-sublime/blob/master/Preferences.sublime-settings#L14
...or rename your ST snippet to something like li2, lit, etc.

Related

p:textEditor <br> line separator instead of <p>

I am using JSF (PrimeFaces) tag p:textEditor for my forum. This tag use Quill rich text editor. Default behavior is wrapping every line in blocks (wraping in paragraphs tags p /p):
<p>line1</p>
<p>line2</p> ....
And it does not looks nice, because of output too much spaces between lines.
Instead, I need to get like this (use tag br/ between lines):
<br/> line1
<br/>line2 .....
For example, PrimeFaces extension has tag pe:ckEditor, that use ckEditor (rich text editor). And I can change its behavior just adding "config.enterMode = CKEDITOR.ENTER_BR;" in config.js file.
Is there in p:textEditor and its Quill (rich text editor) same ability or some another way that can fix my problem?
I was looking into feedback of Quills owner -
https://github.com/quilljs/quill/issues/1074 . And I checked all new versions after this feedback.
So yet Quill does not has this ability. The owner suggests to use css-style for fixing this behaviour (adjust paddings). Yes, it can resolve a problem of big spaces, but:
1) this way is not so comfortable;
2) this way is not suitable for forums quotations, because separate every line in own quote.
Here the problem is discussed and here is some js approach to fix it. But I am not going to use it because I use Quill built in JSF library. So I switch to pe:ckEditor and ckEditor rich text editor

PhpStorm - Use tab and Emmet to wrap code

I love emmet. div.container and then pressing tab has made my life so much easier.
But assume you have a div like this:
<div class="myDiv"> </div> and you want to wrap that inside a container.
What I've been doing so far is typing out
<div class="container">
</div>
Then I copy paste myDiv in between.
There has to be a simpler way, no?
What I'm looking for is being able to put my cursor in front of <div class="myDiv">, type out div.container then press tab, and the result would end up like this:
<div class="container">
<div class="myDiv">
</div>
</div>
Not even sure what the term for this would be. Searching for "phpstorm wrapping" doesn't give me what I need.
Is there a setting for this somewhere that I've missed?
Select your text/code
Code | Surround With... (or Code | Surround with Live Template... -- the menu will be almost the same for HTML context)
Choose Emmet option in appeared popup
Type your emmet sequence
P.S.
It's possible to assign custom shortcut to Surround with Emmet action so it can be called directly (one shortcut that would replace steps #2 and #3). This can be done in Settings/Preferences | Keymap -- just search for the aforementioned action (using search field).
You don't need div.container. A simple .container does the job also. A div is automatically generated if you don't specify the element.
You can do nested elements with >.
In your case it would be: .container>.myDiv. If you want to surround existing items, look at #LazyOne answer. The shortcut for it is [Ctrl] + [Alt] + j (on default settings at least).
For more information look here. (was just a quick google search for "emmet PHPstorm" but it looks good)

Tag and Element shortcuts - Sublime Text 2

Is there a way you can make your own shortcuts for your tags, like if I type in "li" It will automatically put in li type="square" and all I have to do is hit enter?
Have you tried to make your own snippets?
Try the New Snippet command in the Tools-menu and add the following and save it:
<snippet>
<content><![CDATA[
<li type="square">${1:Item} ${2:}
]]></content>
<tabTrigger>li</tabTrigger>
</snippet>
This will enter an <li>-tag in the current file if you type li and then press Tab.
You can also add a <scope> tag to limit it to HTML-files.
From the unofficial documentation:
Snippets can be stored under any package’s folder, but to keep it simple while you’re learning, you can save them to your Packages/User folder

Is it at all possible to display HTML code in Wordpress?

I have tried countless plugins, codyfying HTML with escape keys, and my blood is beginning to boil. Switching between Visual and HTML mode is actually changing my content, ie destroying it!!!
OK, i figured out what to do.
First go into visual mode.
Select Preformatted in the formatting drop down. A little grey box is created.
Inside the grey box, copy and paste your raw HTML.
Save it and switch from visual to HTML views a few times. There should be no mangling.
IT IS ABSOLUTELY CRUCIAL that you paste into visual tab, instead of in the text tab, or it will get stuffed up completely (very unintuitive. You would think it would work the other way araound).
Wordpress does a strange thing where if you switch between visual and "text" mode (HTML mode was renamed in 3.5 update) it strips any tags that appear empty which often times may not be. This might be what you are experiencing if I am understanding the problem correctly.
If you are just trying to display code on your website you should be able to wrap the code like this:
<code><p>Example code post</p></code>
This is laid out in these guidelines here: http://codex.wordpress.org/Writing_Code_in_Your_Posts
If it is a block of code that needs to not wrap you could also use the "pre" tag like so:
<pre><code><p>Example code post</p></code></pre>
This is described very well here: <code> vs <pre> vs <samp> for inline and block code snippets
Yes, it is absolutely possible. You can follow any of the above mentioned methods. I prefer the following way.
First of all, decode the HTML code using online html decoder. You can find any on google. Then, You can paste the decoded code on your post. The benefit of this method is that, your indentation won't be lost.
Decoded Code
Rendered View File
Hope, it helps future reader to find a way.
Wordpress is very buggy. It took me a long time to finally succeed. For my Wordpress.org installed on my pc I tried: go to visual mode, add pre-formatted text block, copy/paste decoded or encoded. I tried :
<pre><code><p>Example code post</p></code></pre>
That did not work.
The only way it works for me is:
Go to visual, instead of adding a pre-formatted text block I create a paragraph text block, copy/paste the encoded HTMl and then convert it to preformat.
Hope that helps.
Perhaps, You should try out this plugin
http://wordpress.org/extend/plugins/insert-html-snippet/
Hope this helps!
One way to do is to make the code commented. Something like,
<!--div>
<md-divider class="org__meta-divider md-soc-theme"></md-divider>
<h4 class="org__meta-heading">Technologies</h4>
<ul layout="" layout-wrap="" class="org__tag-container layout-wrap layout-row">
<li class="organization__tag organization__tag--technology">web services</li>
</ul>
</div-->
instead of
<div>
<md-divider class="org__meta-divider md-soc-theme"></md-divider>
<h4 class="org__meta-heading">Technologies</h4>
<ul layout="" layout-wrap="" class="org__tag-container layout-wrap layout-row">
<li class="organization__tag organization__tag--technology">web services</li>
</ul>
</div>

HTML editor — edit both start and end tag at once

Is there an HTML editor which automatically changes the end tag when you edit the start tag?
Aptana Studio Does. Just set modify pair tag in Window Menu > Preferences > Aptana > Editor > HTML > Typing It is off by default.
IntelliJ has a bunch of XML refactors, one of which is rename tag.
e-texteditor can do this, though not as automatically as you probably want. Ctrl+doubleclick on the beginning and ending tags, and change them that way.
IntelliJ IDEA 14.1 has this feature:
http://blog.jetbrains.com/idea/files/2015/02/simultaneous_tag_editing_2.gif
For instance, if you want to change div to span in:
<div> Text </div>
it's enough to edit one of the tags and the other one will be changed in real time.