How to avoid identation after line break in HTML - html

I have the following HTML body:
<a name="milosz"><h2>Learning</h2></a>
To believe you are magnificent. <br>
And gradually to discover that you are not magnificent.<br>
Enough labor for one human life.<br>
<br>
<br>
In the web page it appears like this:
To believe you are magnificent.
And gradually to discover that you are not magnificent.
Enough labor for one human life.
Note that the from second line onwards the sentences are indented.
Is there a way to avoid such indentation?

You start another line when using a line break with <br>. When followed with a space (which is the ASCII value of a space), naturally this starts the new line with a space. Try removing .
Your case
Code
First line<br>
Second line
Result
First line
Second line
Solution
Code
First line<br>
Second line
Result
First line
Second line

<br> -- Line Break (New Line)
-- For Blank Space
You have written in the end of every line this is for new line (Line Break) and for Indent you are using this is to space
so remove and to keep this in single line.

Use pre tag Like
open (pre) tag
formate
you
want
to show
Close (pre) tag

Related

How do I make BitBucket recognize line breaks in commit comments?

I work with mercurial, and use long(ish), multi-line commit comments.
Recently, I've put my project on BitBucket.org, and have noticed that when my commit comments are appended to issue pages (see this SO question for information on how/when that happens), the newlines are replaced with spaces, while double-newlines stay double-newlines.
How should I mark single-newlines in commit messages so that BitBucket acknowledges them? I'd like to do this in the least-obtrusive way for when I read the comments normally from the command line.
Break paragraphs (generating <p> tags) with a blank line. Break lines (generating a <br> tag) by ending the first line with two or more spaces, e.g.
Line one␣␣
Line two
Bitbucket formats comments using Markdown, which has this to say about paragraphs and line breaks:
Paragraphs and Line Breaks
A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line — a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be indented with spaces or tabs.
The implication of the "one or more consecutive lines of text" rule is that Markdown supports "hard-wrapped" text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s "Convert Line Breaks" option) which translate every line break character in a paragraph into a <br /> tag.
When you do want to insert a <br /> break tag using Markdown, you end a line with two or more spaces, then type return.
Yes, this takes a tad more effort to create a <br />, but a simplistic "every line break is a <br />" rule wouldn’t work for Markdown. Markdown’s email-style blockquoting and multi-paragraph list items work best — and look better — when you format them with hard breaks.

indicate automatic line break in white-space: pre-wrap element

I'm using white-space: pre-wrap style on a HTML <pre> element to allow lines to break when they are longer than the browser window is wide.
Unfortunately those broken lines also look as if they have a line break at the end; the user cannot see if it was an automatic line break.
Is there a way to show either at the end of the line that wrapping is going on (as emacs does with a \ character), or at the beginning of wrapped lines that they are a continuation of a previous line (e.g. with →)?
Copying & pasting should not copy the continuation characters.
Example code:
<pre style="white-space: pre-wrap">for i in range(19): selwidth=5; selheight=1000; image = gimp.image_list()[0];posx=initx+i*90; pdb.gimp_image_select_polygon(image, 2, 8, [posx, 0, posx+selwidth, 0, posx+selwidth-selheight, selheight, posx-selheight, selheight]);</pre >
Preferred rendering, with a → at the beginning of continuation lines:
for i in range(19): selwidth=5; selheight=1000; image = gimp.image_list()[0];posx=
→initx+i*90; pdb.gimp_image_select_polygon(image, 2, 8, [posx, 0, posx+selwidth, 0,
→posx+selwidth-selheight, selheight, posx-selheight, selheight]);
Pre is intended to keep text as it was typed. It helped keep poems and speciality text as they were intended to be seen and not formatted by the browser. I would think most people will be able to tell a line of text is being wrapped in Pre with whitespace: pre-wrap because it would look something like this:
Five little monkeys jumping on the
bed, {{line break}}
One fell off and bumped his head. {{line break}}
Mama called the Doctor and the
Doctor said,{{line break}}
"No more monkeys jumping on the bed!'.{{line break}}
If you went with straight HTML <p> it would look as you had typed it in your example and <pre> with whitespace: pre-wrap would look the space as you have it typed.
To color the ends of each line you might try putting a <span> and give it CSS to color and size or do a <span> on the whole sentence giving it a CSS background color.
AFAIK not with CSS, instead you can replace every newline with 2 newlines so newlines will be distinguished when text wraps, to do this either manually enter two -or more- line-breaks <br>s for each new line, or if you can use javascript then you can replace each semi-colon ; -because the provided example in the question is code where each line ends with ;- replace it with ;\n\n -or with ;<br><br> instead- thus it will recognized.
JS Fiddle
var pre = document.getElementsByTagName('pre')[0],
preHTML = pre.innerHTML;
pre.innerHTML = preHTML.replace(/;\s*/g, ";\n\n");
<pre style="white-space: pre-wrap">for i in range(19): selwidth=5; selheight=1000; image = gimp.image_list()[0];posx=initx+i*90; pdb.gimp_image_select_polygon(image, 2, 8, [posx, 0, posx+selwidth, 0, posx+selwidth-selheight, selheight, posx-selheight, selheight]);</pre >

SublimeText2 - Wrap lines with quotes or tags skipping initial whitespaces

I know i can select a block of lines, and then split it into many selections, one per line, using Ctrl+Shift+L then just typing a quote it will wrap the line automatically or to wrap each line with htlm tags I know I can use ctrl+shift+w
The problem is that I would like to skip the initial whitespaces of each line and just adding a quote or a html tag at the begging of the first word.
ps: Im using SublimeText 2 with Vintage
Select a block, then press:
Ctrl+Shift+L, Home, Shift+End
Is that what you are looking for?
Select a block, then press:
Command+Shift+L, right-arrow, Command+Shift+left-arrow
(Note: I'm on a mac.)

Force line break (<br/>) in header (<h1>) in Markdown

I'm trying to create a two-line <h1> in Markdown, something along the lines of:
<h1>Title<br/>byline</h1>
The Markdown docs say:
When you do want to insert a <br /> break tag using Markdown, you end a line with two or more spaces, then type return.
Unfortunately, this only seems to work for paragraphs -- if I try it with an <h1> (dots · indicate spaces):
#·Title··
byline
the trailing spaces are ignored and I just get:
<h1>Title</h1>
<p>byline</p>
Can anyone tell me a workaround for this?
P.S. I'm using vanilla Markdown 1.0.1 from the command line.
Turns out the answer is just "use <br/>."
# Title <br/> byline
produces
<h1>Title <br/> byline</h1>
** facepalm **
Just use the alternative syntax for <h1>:
Title··
byline
========
You can also do double space at the end of the line.
For example, this text appears in the same line even though I've written it on the next line.
This appears on a new line.
The thing is there are 2 blank spaces after next line... (Consider those two dots as spaces)
Hope this helps. This also seems better than </BR>.
Reference: http://markdown-guide.readthedocs.io/en/latest/basics.html

php/html: Force line breaks to appear inside textarea

This should not be that hard but I can't seem to find information on it. How do you get line breaks to appear inside a text area when you are echoing it from the server? In other words what is <some code> in line below?
<text area>first line <some code> second line <some code> third line</text area>
I know how to write out <some code>. I just need to know what it should be. I have tried \n, \r\n, '\n', "\n", \N and variations but cannot get the line breaks to display.
Note: This is not about displaying in HTML so <br> is not what I want. This is not about getting it to display if you are typing it yourself where you can type a carriage return, i.e. :
<textarea>first line
second line </textarea>
When you are outputting from server you cannot use keyboard. This is what code to accomplish above.
Thanks for any suggestions
This is a super old question, but I ran into the same issue ajaxing content into a text area.
Thanks to this answer I used the html code for a new line,
and that worked for me. So basically:
<textarea> Here's my returned text
And it gets two lines </textarea>
which (at least for me) comes out as
Here's my returned text
And it gets two lines
try this
<'p'>firstline<'/p'>
<'p'>secondline<'/p'>
remove comma from p and /p
for display \n in html you should use nl2br() php function .
otherwise you should using "\n" (not "/n") for break the line inside your text ;
You should try \r\n instead of /r/n.
You need to use "\r\n" (with double quotes) when echoing it out from PHP.