I want to use the "Emmet" snippet of atom, but it is not working properly when I press tab after the tag name.
Code:
'atom-text-editor:not([mini])':
'tab': 'emmet:expand-abbreviation-with-tab'
but still when I apply this it is just printing simple tag like this: <html></html>
CoffeeScript (and CSON, CoffeeScript Object Notation) is an indentation-sensitive languages, so you need to make sure you're using the correct indentation. When you edit snippets.cson and press Enter, the editor will indent the second line automatically.
In the end it should look like this:
'atom-text-editor:not([mini])':
'tab': 'emmet:expand-abbreviation-with-tab'
Related
I am building a ruby on rails application using simple form and haml for the views. However I've noticed an issue with regards to forms that have textareas. I didn't notice it at first however when I save some text in a textarea and dump it in a pre tag I've noticed that every line break is followed by a number of ugly white spaces. I'm not sure whats going on here. So if I enter something like the following in a textarea:
THIS IS ONE LINE
THIS IS ANOTHER LINE
THIS SHOULD NOT BE INDENTED
THIS SHOULD BE INDENTED BY TWO SPACES
Outputting it into a pre tag gives:
THIS IS ONE LINE
THIS IS ANOTHER LINE
THIS SHOULD NOT BE INDENTED
THIS SHOULD BE INDENTED BY TWO SPACES
I'm pretty lost here - this is my basic textarea code - nothing much(added the tilde after hearing that it would help in removing unwanted spaces - didn't work at all):
~f.input :details, :label=>false, :input_html=>{:class=>'span12 input-code', :rows=>40}
Another observation - the spaces do not show up in the textarea if I render the text area using simple form - however if I manually code in a textarea to output the contents it shows the spaces. Could this have anything to do with the simpleForm gem?
I know this is a very old post but I came here looking for a solution to the exact same issue so I thought on sharing the solution I found on another link in case someone comes here too...
For me this happened on my Rails 5 app, that uses simple_form and HAML.
The reason of the additional spaces is HAML, and in order to avoid them, you need to add to the config/initializers/haml.rb the following line:
Haml::Template.options[:remove_whitespace] = true
Here's the source of my answer (check the very last comment by adavia): https://github.com/haml/haml/issues/643
And just in case, here's the list of options HAML allows: http://haml.info/docs/yardoc/Haml/Options.html
Edit
This option also works:
Haml::Template.options[:ugly] = true
In my rails application, people are supposed to submit "posts." However, in the default scaffolding, there are some problems in the text input: not allowed HTML code, changing the line doesn't work, etc. From what I've learned, I need to use a markdown-markup language to solve this issue. Is there a guide for me to follow to apply such language to solve my problem?
UPDATE: Here are my problems.
1) Every sentence is combined into one line even if I put a line space.
first line
second line
becomes
first line second line
2) I can't make text bold, italicized, or hyperlink. Like in stackoverflow, user should easily put <b> and make bold text, ** to make italicized, etc. And URL address should automatically be translated to href link.
To do these, I thought I had to use markdown library. I could be mistaken, so I needed someone to guide me through. Railscasts on Markdown
Well, yes, new lines in HTML have no meaning. You need to replace line breaks with <br> to preserve them in HTML. To automatically highlight links, you need to look for links in the text and wrap them in appropriate <a> tags. Finally, if you're not filtering HTML tags, they should still be in there. It all depends on what you're doing. Markdown is something entirely different, a special markup language that enables you to do the above while being easier to write than HTML. It depends on what you want to use.
I was wondering if there is a way to get Sublime Text 2 to autocomplete HTML attributes like in Aptana?
Autocomplete is enabled by default when you use "<" and your tag and then hit enter. So if you enter <p and then hit enter it will finish out the tag pair for you... where you will end up with <p></p> and your cursor will be in the middle. You can change this to tab if you prefer by pasting the following into your Preferences -> Settings - User file:
{
"auto_complete_commit_on_tab": true
}
This will override the default value of false for completion on tab. Again that is only if you wish to use tab instead of enter.
Hey you may try https://github.com/agibsonsw/HTMLAttributes or install trought package control package called "HTMLAttributes" ;). Its works for me. For example you type:
<p then press space bar then ctrl+space and you got list of attributes.
You can try to use emmet package. It was made specifically for html&css code completion. For more information you should read the documentation.
I was having the same issue; although I use both plugin packages HTMLAttributes and Emmet, neither one provides the auto-complete functionality I was looking for that's similar to Dreamweaver's.
Solution: I found a package called SublimeCodeIntel that does exactly what I needed.
Example: I code html emails and do a lot of inline CSS. End goal:
<td style="vertical-align:top;">
After installing SublimeCodeIntel, I typed <td style="v and a list of CSS properties starting with "v" displays.
Using my arrow keys, I select vertical-align and press tab to confirm, then type the letter "t" and a list of CSS values now displays.
I select top and then press tab to again confirm my selection.
Note: You can create predefined snippets for Emmet for undefined CSS properties but I wanted something "out of the box" instead of having to a) learn how to create them via the documentation (though I'm sure it's simple), and b) create a snippet each time I came across an undefined CSS property/value like vertical-align.
Hope this helps.
I have a micropost feature and was testing the way it formats text that has been posted when displaying back to the user.
I pasted the following text like this:
and this was displayed back to me:
I'm using "simple_format h(content)". When I remove the helper the text is displayed with out a new line from the word "In". It displays as one big paragraph so I assume the helper is working but for some reason my double new lines are being ignored.
Any idea what is going on? Am I missing something?
By seeing it back, do you mean inside a textarea, or on the page? If it's on the page, all whitespace is compressed to one space each. If it's the latter, simply use the css rule:
white-space:pre;
On the proper selector.
However, if it is in a textarea (which preserves whitespace by default), there must be something stripping the extra space when you save it into the database. You might want to debug down your stack in the model & controller, to see where this might be happening. I have to admit i haven't used the the simple_format method.
Thanks to chrome developer tools as per usual. I realised that each text separated by 2 new lines were wrapped with p tags so I just added a bottom margin of 5px using css to p. Works perfectly.
I'd like to have a link generated with BlueCloth that opens in a new window. All I could find was the ordinary [Google](http://www.google.com/) syntax but nothing with a new window.
Ideas?
Regards
Tom
Here is a complete reference for markdown: http://daringfireball.net/projects/markdown/syntax
And since there is no mention of how to set the target attribute, I would believe it is not directly possible, but the reference also says:
For any markup that is not covered by
Markdown’s syntax, you simply use HTML
itself. There’s no need to preface it
or delimit it to indicate that you’re
switching from Markdown to HTML; you
just use the tags.
Source: http://daringfireball.net/projects/markdown/syntax#html
So I would suggest you have to use the html syntax for links like this
update
if you wrap the markdown generated content in a div with a specific id like this:
and you use jQuery, you can add the following javascript:
$('#some_id a').attr('target','_blank');
Or you can save the BlueCloth output in a variable before outputting.
markdown_generated_string.gsub!(/<a\s+/i,'<a target="_blank" ')