olivierkes / manuskript

A open-source tool for writers
http://www.theologeek.ch/manuskript
GNU General Public License v3.0
1.75k stars 232 forks source link

Export doesn't detect the new line #1234

Open FastusNumen opened 1 year ago

FastusNumen commented 1 year ago

I don't know if I missed a setting but the export for .odt and .docx doesn't see when I change to a new line, so the whole scene is one single paragraph.

I have to go over the whole text again to make them, hoping I don't miss one.

TheJackiMonster commented 12 months ago

That's because Manuskript uses Markdown by default which does not have a new line character or command. So you can either make two new lines to start a separate paragraph, I think or you use the character replacements in the export settings. Basically you can replace a new line character (which is typically encoded via \n) by a HTML break tag (written like this: <br>).

Because Manuskript translates your documents first into HTML during export and afterwards into the target format. At least I assume that's how it works from my experience.

FastusNumen commented 12 months ago

That's because Manuskript uses Markdown by default which does not have a new line character or command. So you can either make two new lines to start a separate paragraph, I think or you use the character replacements in the export settings. Basically you can replace a new line character (which is typically encoded via \n) by a HTML break tag (written like this: <br>).

Because Manuskript translates your documents first into HTML during export and afterwards into the target format. At least I assume that's how it works from my experience.

It didn't work, but I found a method anyway. It's the same as in issue #972: I had to replace \n with \

.

Screenshot 2023-10-05 111951

Maybe it should be made as a default replacement, so people don't have to search for how to do it.

obw commented 12 months ago

When I remember correctly, the search is also a RegExp, so something like this would be better:

Start of line Replace: ^ With: <p>

End of Line Replace: $ With: </p>

so it's automatic valid HTML!

TheJackiMonster commented 12 months ago

@FastusBellrune I guess adding this as simple checkbox option sounds reasonable. I agree with obw that it should create valid HTML though.

FastusNumen commented 12 months ago

@TheJackiMonster I agree it should be valid HTML, but I just don't know how to place the \

at the start of the paragraph since I don't know what I should replace with that. As I am using it right now it also breaks the formatting of the title and probably other things so, if you can suggest how to do that, I will try it. I already tried @obw replacements but they don't work.

obw commented 12 months ago

Sorry, I didn't use the internal export system, I'm working with own php scripts, because of my Mode of publishing, Chapter wise for patreon!

Also, these scripts a something I'm not proud of, when they have gotten there overhaul, I will perhaps publish them...

The target is it, to generate a Chapter and send it direct as HTML to over the API to patreon, including scheduling, setting the tear and so on! But firt I must work on some other projects and complete them!

TheJackiMonster commented 12 months ago

@obw Maybe we can try to allow more advanced option for export in the future. For example we could allow integrating modular scripts for text processing into the export dialog. So users could exchange custom scripts for text processing.

obw commented 12 months ago

@TheJackiMonster would be nice, even nicer when it's possible to integrate shell commands here, as I had said on other places, phyton and I are not god friend;)

The whole thing will be using D as language, because what I'm planning, there is need for speed, which means a compiled language! The feature with the Export is mostly a byproduct.

TheJackiMonster commented 12 months ago

I actually thought about running any binary or shell script piping the text into it. Then piping the output to the next module or the final export step. So nobody would need to use Python but of course that would be possible as well. ^^

SpeedyDoggo commented 3 months ago

This behavior is still present in 0.16.1, thought I'd mention the version name for ease of timelines.

I've been fiddling around with converting the raw .md files (which as far as I can tell are just .txt files another name) into HTML using JS and it works well for my purposes. The raw .md file does preserve the line breaks so a simple replaceAll('\n', '<br>') does the trick and there is a way to finagle it to make each separate line have its own <p> tag for formatting purposes.

It makes me wonder if there would be a way for exporting to skip the conversion into markdown for these formats specifically, at least to determine linebreaks?