olivierkes / manuskript

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

Page breaks and templates/reference-doc for pandoc #477

Open kakaroto opened 5 years ago

kakaroto commented 5 years ago

I've just started using Manuskript and I like it a lot (other than the frequent crashes unfortunately, slow downs and a couple of issues, but I can live with most of that). The thing that is annoying me the most at the moment though is the compile options because we can only export to HTML with Manuskript itself (which works quite well), but for doc/openoffice/epub, we have to use pandoc and it has trouble with some things, such as text alignment (I've seen their open issue on the subject https://github.com/jgm/pandoc/issues/719 and I've seen the issue reported here as well https://github.com/olivierkes/manuskript/issues/301).

When I use :

# <center> Chapter 1

It works well in Manuskript's HTML export (centered heading), but with pandoc, it will show the # on a line on its own, then followed by the centered text on the next line. If I instead write :

<center> # Chapter 1

Then in Manuskript's HTML export, it will show a centered # Chapter 1 but it will appear correctly in pandoc's HTML export. This difference in behavior between Manuskript and pandoc is very annoying and I wanted to mention it, even though you probably can't do much about it (not without introducing a regression).

The main issue for me is that the exported document by pandoc has a very bad formatting.

A solution to my issues are the following :

For the template idea, have a look at this repo with template docs. pandoc has a --template option for those, or a --reference-doc option for docx/pptx/odt. If I place a reference.docx in my data dir (../AppData/Roaming/pandoc), it picks it up automatically and it works (but it's not so obvious for users, and people might want different templates per book). This helped me fix a lot of my issues. I added a transform to replace all the <center> with ###### and I set the reference template to set the heading 6 style to be centered, which works great for my * * * scene breakers, and I could set my styles for each heading and body text, etc..!

I think it would be great if we could generate manuscripts with manuskript which follows the standard manuscript format. With the reference.docx/reference.odt file, and a few regexp tricks, I can now achieve that. All I'd need after an export is to add the header which shows page numbers and do a page break on each chapter (note: the <center> # issue and the triple apostrophe not being recognized for verbatim are remaining which makes manuskript's HTML export break as I tailor the markdown for pandoc).

kakaroto commented 5 years ago

Good news, I've managed to fix pretty much everything with workarounds: the reference.docx trick held the answer to everything.

Overall, I have everything I need right now, though it took a lot of workarounds. I would still suggest adding the feature for the page break separator in the combobox, and the option to specify the reference document or template, as well as the option for docx to enable the custom styles (will be easier to set a custom style in the reference doc and specify it by name rather than having to rely on unused headings) as it can help others. If not, at least this issue has information on how the behavior can be achieved with pandoc for others to refer to in the future.

EDIT: I added the docx+styles support, but it turns out it wasn't needed because the styles extension is enabled by default. I've used that to create new styles and not re-use headings for my needs, this way the resulting docx doesn't have bookmarks everywhere a text is centered or styled differently.

Biep commented 1 year ago

Especially the lack of options (or documentation for options) for separators is annoying. I can see that "\n" produces a newline. What other codes are there? I'd really love to have page breaks. Also, "I want more granularity". For the top two levels of folders I want page breaks, whereas for deeper levels a newline is just fine. Thank you for working on this program!