EpicEditor icon indicating copy to clipboard operation
EpicEditor copied to clipboard

Automatically add breaks on the line end

Open fuddl opened this issue 12 years ago • 11 comments

In order to keep the plain text readable also on wide screens, markdown has this nice logic of ignoring brakes at parsing. So that the user is able to add breaks by himself. Here this could work automatically. So on writing it should constantly check how long the line is and if its too long, it should add a linebreak(+indention) before that last word.

For this it would be necessary to add a line length limit as a configurable variable. For example this has a line length limit of 30 (which is very low):

Lorem ipsum dolor
sit amet, consectetuer
adipiscing elit, sed
diam nonummy nibh
euismod tincidunt ut 
laoreet dolore magna 
aliquam erat volutpat. 

* Ut wisi enim ad minim
  veniam, quis nostrud
  exerci tation 
  ullamcorper suscipit 
  lobortis nisl ut
  aliquip ex ea commodo
  consequat. 
* Duis autem vel eum 
  iriure dolor in 
  hendrerit in 
  vulputate velit esse 
  molestie consequat.

Note: This should not affect links or it should convert links into 'reference style'

fuddl avatar Aug 21 '12 10:08 fuddl

Couldnt you simply add some padding or margin on the editor to achieve the same result?

OscarGodson avatar Aug 21 '12 14:08 OscarGodson

Here's an example where I just changed the body width to 350px:

Is your main concern long links with this?

OscarGodson avatar Aug 21 '12 14:08 OscarGodson

That only affects the presentation. The actual text has no css ^^

fuddl avatar Aug 21 '12 15:08 fuddl

Yes, absolutely. Why would you want the actual code to have breaks in it? I'm only asking to better understand the use case.

OscarGodson avatar Aug 21 '12 15:08 OscarGodson

To make it readable 'as it is'. for example you want to copy and paste it to an email or you save it in a text file or in a database

fuddl avatar Aug 21 '12 15:08 fuddl

Awh yes. That makes sense. Great use case. I'll add this to my list :)

OscarGodson avatar Aug 21 '12 17:08 OscarGodson

Wouldn't that be do-able with Marked's option to use GFM-style breaks? I was going to add an issue to allow passing options through to Marked, but since I wanted it for this specific purpose, will just add my $0.02 here.

Poetry is another use case, for this.

dethe avatar Mar 28 '14 18:03 dethe

@dethe not sure I understand. Yeah, you can totally make these breaks yourself if you wanted. @fuddl wanted these breaks to happen automatically.

OscarGodson avatar Mar 28 '14 23:03 OscarGodson

I thought he wanted existing linebreaks to be honored, which GFM does, but original Markdown doesn't. In Markdown you have to end a line with two or more spaces to get a linebreak, which is terrible usability since it is not visible, and takes a fair amount of typing to get the behaviour of "just keep what I have already."

Marked does this already, but it is not the default, you have to pass an option to it. I see in your (very nice) docs how to replace Marked with a different Markdown parser, but not how to pass arguments through to Marked.

dethe avatar Mar 29 '14 05:03 dethe

...on writing it should constantly check how long the line is and if its too long, it should add a linebreak(+indention) before that last word.

I think that's the tl;dr version of the ticket. :) there's a few tickets regarding pasting tho. In https://github.com/OscarGodson/EpicEditor/issues/308 @W4RH4WK makes a suggestion about turning off our HTML paste cleaner which i think is a good idea.

OscarGodson avatar Mar 29 '14 18:03 OscarGodson

Ah, I see. I'll add a different ticket for my issue then. Thanks for the clarification.

dethe avatar Mar 30 '14 16:03 dethe