In SublimeText2, some of my whitespace behaves strangely.
For example, I I select the contents of a script (as shown in the screenshot below), and do shift+tab (to reduce indentation) it only works on the lines with normal spacing, resulting in my code indentation becoming all wonky.
Notes:
the non-space white spaces are not tabs,
it's set to indent using spaces
doing "convert tabs to spaces" has no effect.
My settings file has: "draw_white_space": "all",
I think this only happens with code pasted from elsewhere (like oneNote), and the only way I've found to deal with it is to manually replace the spacing with actual spaces.
Does anyone have an explanation for this behavior or a way to better deal with it?
I'd assume they're something non-ASCII-ish that looks like whitespace, but actually isn't.
When I have files like this I generally hex dump them from the command line, or you can install a Sublime hex editor like HexViewer via normal package management that lets you do some fun stuff.
Once you know what the offending character(s) are you can use regular search-and-replace to make them be actual spaces, tabs, or whatever seems appropriate.
Related
There is issue related to CKEditor paragraph spacing. If I'm typing in ckeditor, it works fine. If I copy paste something from browser, it works fine. But when I copy paste something from word file, I get large space between two paragraphs. So I manually need to remove a extra line between two paragraphs. I have searched on internet for solution. And I got some solutions too. But none of them is working for copy/paste from word file. I have tried these solutions.
Solution 1
Solution 2
These solution are working fine to solve issue while manually typing or copy/paste form browser. But not working for copy/paste from word file. And I can't understand why this happens. If any one knows the answer, it will be appreciated.
Use Paste from Word option on menu bar of CKEditor.
That way you will receive MS Word formatted text converted to WEB formatting.
Usually when copying text from some text pre-processors (like Word, Excel...) you will copy some hidden formatting (like inline CSS, additional markup and so on). When pasting to CKEditor directly all these additions are left as is and it leads to broken layout, that's why you need to first process this copied text and only than put it in text.
I am looking for a way to force a new line / break line in a HTML text box. It's a "description" box and I need to convey a bunch of information (main description, multiple download links, social media links, ...), and would like to give it a slightly nicer, more readable spacing.
The box' line breaking works the same as it does here on Stackoverflow:
breaking the line once in the editor, results in the lines of text staying together in the rendering.
breaking the line twice, results in a new paragraph with a small whitespace in front.
breaking the line three or more times, does the same as just doing it twice.
And I can only input flat text, but on my Mac, I can press Alt+Space to type the Unicode character for a No-Break Space (" "), with the same result as if I added & nbsp; into the HTML file. Together with "•" (Shift+Alt+.), this works perfectly to force the appearance of an unordered list (even nested ones, if I want to).
So now I'm looking for a way to do the same with a New Line, so I can better space out my blocks of information. Any ideas?
PS: I know this will make a lot of web developers cringe, but because I'm just using Unicode characters, it won't break anything. If the site expects you to post download links and contact information, why didn't they just provide segments for those, to do it correctly, instead of just a single "Description" box? There are separate boxes for "Technology used" and "Help / Controls", so why not for "Download", "Contact Info", ...? :/
PPS: I guess forcing a horizontal rule would be fine too (and maybe look even better)
I used syntaxhighlighter in my front web page to highlight code. But I came across a question that the word in the code isn't wrapped when the code length is longer than the length of the <div>.
then I googled it. And found a way mentioned below:
pre,code{
white-space:pre-wrap;/*css-3*/
white-space:-moz-pre-wrap;/*Mozilla,since1999*/
white-space:-pre-wrap;/*Opera4-6*/
white-space:-o-pre-wrap;/*Opera7*/
word-wrap:break-word;/*InternetExplorer5.5+*/
}
However, a new problem appeared, the line number is not corresponding to the actual code line:
My question is:
How can I avoid the code overflows while keep the code line be corresponding to the actual original code line?
You can use CodeMirror editor. It has a lot of feature support including word wrap and read-only like the Sublime Text Editor.
I guess it does correspond the original code lines. Because of the wrapping you are getting messed up with the numbering. Try wrapping the code with JavaScript - add new line symbol \n and and caret returning symbol \r (depends on your programming environment and its settings) and see if it helps.
You have to make some changes to the JavaScript, too.
It's explained at the bottom of the comment section here, including a demonstration in jsfiddle: https://bitbucket.org/alexg/syntaxhighlighter/issue/182/version-3-making-code-wrap
I have a horrible, ugly HTML file that was spat out by a form generator and slightly modified to look nice. This HTML file needs to be translated, so I hooked up some scripts using po4a and csv2po, and that all works fairly well except for one thing: some of the base strings in our translation templates are surrounded by whitespace, and the translators get rather confused.
The other thing is I have this working with a Makefile (because that generated form is updated quite frequently and I'm a nerd). I'd like to keep it that way because it's nice for my workflow. So, I need a command line tool.
I'm really looking for the simplest solution in this case, so I ran the HTML file through HTML Tidy, and that removes the weird whitespace quite competently. However, it does a lot of stuff I don't need. It messes with the doctype (and it doesn't support an html5 doctype), and I've ended up with a really crazy command line just to get it to not mangle things. It is not very pleasant.
All I really want is a command line tool (not an online one) whose single goal in life is to look at my HTML file and format it nicely. Ideally not a "compressor" thing, but if that's the only option, suggestions would be nice :)
Stick it in an ide or text editor like notepad++ or net beans and hit the "format code" button which is available in nearly every ide?
I'm not sure if it is still being developed, but would HTML Tidy do the trick?
I've noticed that most of the HTML/XML/HAML that gets generated from plugins uses 2 spaces instead of 1 tab. I use textmate and have tabs set to 4 spaces for HAML/HTML/XML and 2 spaces for Javascript/Ruby, but I only have to press the tab key once to get nice indentation. Pressing the space bar twice and delete twice seems like too much work :p.
Do you manually type two spaces, or is some middle layer converting tabs to two spaces? Or do just a few of you use tabs?
2 spaces is generally agreed-upon.
As for all the arguments about different editors showing tabs with different widths...
It is a configuration setting people!
Change your editors to use two spaces for each tab. Different widths in different editors is not an argument. It is a moot point. If anything, using tabs allows people who prefer different widths to set and use the width they prefer. Hell, I think I like 3 spaces.
And you have to hit backspace twice just to un-indent something once. I'm a programmer, I'm lazy. I don't like to do things more than once!
2 spaces. Even for the plain Ruby kids.
Two spaces are emerging as the standard because they are “just enough” indentation to make the HTML clearly indented to most people's eyes, but because HTML tends to nest very deeply — much more deeply than one would commonly nest when programming — and anything more than two spaces tends to start pushing HTML off the right edge of an 80-column screen pretty quickly.
Do not use tabs; use two spaces. Tabs are problematic because they can be a different width in different editors (and terminals, for that matter). Since whitespace is removed when you tidy your HTML before deployment, there is no ultimate bandwidth benefit to using tabs; they simply introduce a wildcard into your development experience.
I use Emacs, which auto-indents XML, HTML, and SGML with two spaces. I would be quite annoyed if I had to type indentation characters by myself; that's why I have an editor. :)
2 spaces is the convention for Ruby which Ruby on Rails is based upon.
In more practical terms, if you use mutliple OS and editors ( such as at work I used RubyMine on Win XP and TextMate on my MacBook at home and one of our developers uses Notepad ++ and another Aptana and we even have one who uses Netbeans, all of these editors interpret tabs differently - different indentation, but 2 spaces are always 2 spaces. Also if you ever use HAML or if you need to copy paste your code into some websites that try to colorcode your code, 2 spaces are essential.