manuskript icon indicating copy to clipboard operation
manuskript copied to clipboard

Export doesn't detect the new line

Open FastusNumen opened this issue 1 year ago • 10 comments

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.

FastusNumen avatar Oct 04 '23 14:10 FastusNumen

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.

TheJackiMonster avatar Oct 05 '23 00:10 TheJackiMonster

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 <p>.

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.

FastusNumen avatar Oct 05 '23 09:10 FastusNumen

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!

obw avatar Oct 05 '23 10:10 obw

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

TheJackiMonster avatar Oct 05 '23 12:10 TheJackiMonster

@TheJackiMonster I agree it should be valid HTML, but I just don't know how to place the <p> 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.

FastusNumen avatar Oct 05 '23 12:10 FastusNumen

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!

obw avatar Oct 05 '23 13:10 obw

@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.

TheJackiMonster avatar Oct 05 '23 13:10 TheJackiMonster

@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.

obw avatar Oct 05 '23 13:10 obw

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. ^^

TheJackiMonster avatar Oct 05 '23 13:10 TheJackiMonster

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?

SpeedyDoggo avatar Jun 23 '24 16:06 SpeedyDoggo