On Saturday, September 12, 2020 at 12:26:14 AM UTC+2, TonyM wrote: This is what is making me unsure, around the \n and \n\n cases; > > I did create the "Add a new-line at the end of the line" toolbar button, >> that will double up every existing \n to convert a marked block of text >> into html P tags. > > > Is this so you can take multiple lines and combine them into one paragraph? >
No. If I want to combine multiple lines I remove the single line break. ... Except for the last one it gets 2. > > - so you use \n\n as the end of block "endString"? > > That's the default behaviour of TW. 2 newlines give a P tag. Angle qoute internally uses \n\n .... All the others use \n > > - Is this why you started using div for blocks because P separated > every line? > > 1 newline gives a DIV, that is styled with the same margin-top and -bottom as a P tag. I used a DIV, because it is more flexible with valid html content. If you create a <p><div>....</div></p> you create an invalid html structure, because P tags should only contain "phrasing content <https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content>". .. Sure browsers show it, but technically it is wrong. > The reason I wanted to do this based on \n only is as follows; > > - if \n can be used as the end string to create a paragraph, once a > paragraph is created there is always a blank line that follows that > paragraph, HTML standard with P > - if there is a second or third \n, ie blank lines and you apply the > same prefix to each then please follow what happens below; > > try the following lines in 0.2.3 and you'll see, it works as you expected. .. There is no need to add ticks to empty lines. ´ line 1 ´ line 2 ´ line 3 > In this example I use 'p to represent the custom tick for paragraph > Individually or bulk inclusion of the 'p<spaces> to every line gives > 'p Paragraph > 'p > 'p > 'p penultimate paragraph > 'p Last paragraph > > Becomes on render > <p>Paragraph</p> > <p></p> > <p></p> > <p>penultimate paragraph</p> > <p>Last Paragraph</p> > The actual code doesn't work that way anymore. ... Have a closer look. [...] > It seems to me that my use case exclusively needs only \n as the end > string, it's when you wish to block format such as a div that this changes, > and where we may want to have an alternative end string such as \n\n, > Yes. That's your usecase. But in my texts there is no single linebreak for a pragraph. If I do have 1 newline, I will double it. So TW will create P tags. Those P tags will be styled using the "angle quote". > > - Are you placing "\n\n" in the content effectivly so you can use it > as an end string? > > Yes. That was the reason for the toolbar button. > > - Or Can you NOT rely on the \n\n in the content in many cases, thus > you need to add it? > > If there are 2 newlines it's OK, if there is only 1 I'll add more or remove it. ... That's how it works for me. > Given we can now specify the end string, perhaps the default behaviour > should be endstring "\n" on newlines (visible or not). After all this is > what > confuses everyone new to tiddlywiki, ie when using line based wiki text > the line feed is honoured > Most wikitext parsers works that way. That's not specific to TW. eg * # ! a newline is created, but any "free text" ends up concatenated > with the content above and the (first) new line hidden. > That's the default behaviour of every wikitext engine. It's the same behaviour for most markdown parsers. There is only 1 exception "markdown github flavour". Even the new Commonmark spec <https://spec.commonmark.org/0.29/#soft-line-breaks>uses this behaviour. Have a look at the "soft linebreak" ... scroll up a little bit and you'll see "hard linebreaks" definition. > It seems to me that given the value of a 'p to resolve this issue, with > line breaks, *just as every other wikitext special character does as > well,* > > - but in this case on any/every line then this should be a primary > focus, > - with the \n\n cases only secondary? > > That's you point of view. --- From my point of view it's completely different. I don't have blocks of text with only 1 newline. And if I have them I either need to remove them or make 2 to indicate a new paragraph. (Single newlines are poison for me. They will create problems in the future. Trust me. I remove them, or use 2! Always) > Restated, we need to fix the fact that in the editor > This is a line or paragraph > This is another line or paragraph > Automatically becomes > This is a line or paragraph This is another line or paragraph > No. That's OK and standard. TW core will not change this and it shouldn't. HTML ignores \n characters completely and there is a reason! They use CSS settings to show hard-line breaks. .. That's OK. We can do so now. ´ This is a line or paragraph ´ This is another line or paragraph And > This is a line or paragraph > > This is another line or paragraph > *Looks the same after render* > If we use ticks now. ... Yes. Note: There is no way to display this as entered (without workarounds) > This is a line or paragraph > This is another line or paragraph > Sure. Just change the CSS settings and you are good to go. I have chosen to use paragraphs to help when the content has many extra > line breaks, but other html tags will deliver the output as seen in the > editor text. > > - Note this is \n in action not \n\n > > I hope this is clearer. > I think I know what you want, and all the IDs work that way. .. Except the "angle quote". It works with \n\n by default, because I need it that way to indent and style TW paragraphs. As a mentor once said to me if you perceive a problem then consider some > possible solutions then come to me with the "problem and possible > solution", not just the problem. So I will try. > As I wrote. It seems my workflow is completely different to yours. But that's OK. With the "tick-text" plugin I think we both can have what we wanted and much more. have fun! mario -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/6cbbbd07-bec7-4590-829f-a5f95283a761o%40googlegroups.com.
