mb21 / panwriter

Markdown editor with pandoc integration and paginated preview.
https://PanWriter.com
GNU General Public License v3.0
1.03k stars 49 forks source link

Lost CSS preview rendering #61

Closed andreagam closed 3 years ago

andreagam commented 3 years ago

Hello and thanks for this beautiful piece of software. I’m using it for my documents and I like the idea to keep content and styling separated. But from version 0.8.0 my files with a yaml header that recalls a css file are not working anymore. Example: My yaml header is something like this:

---
type: doc
---

Then I have a css file called doc.css in the PanWriterUserData folder which applies the style rules for the document in the preview. From version 0.8.0 this is not working. I’m running Panwriter on a MacBook with Big Sur OS. By the way, I downgraded to version 0.7.2 but it keeps to automatically update to 0.8.0 every time I launch the app. Anyone can tell how to prevent it from updating? Thanks a lot!

mb21 commented 3 years ago

Thanks for getting in touch! I just added a proper note to the 0.8.0 release:

Major refactorings were done for 0.8.0, which should be a better basis for future work.

In the process, one feature was removed: the ability to read user-customizable css files

Maybe we can add something like that in the future again, but will have to work with pandoc's document-css (which we'd need to parse properly) or work with pandoc's default files.

So yes, that feature was removed for now, sorry!

I also just checked the electron-updater package for a way to be disable the auto-update, but I think I'll have to implement that myself (and haven't done so yet in 0.8.0)... so besides blocking the app from accessing the internet, I'm afraid it will probably auto-update all the time...

I'll try to come up with a fix for these issues shortly!

andreagam commented 3 years ago

Hi Mauro, thanks for your answer. I'm sorry to hear that the ability to read external user-customizable css files has been removed purposedly. In fact, that was the killing feature for me because it was super-useful to write a text (e.g.: a software project) and having the possibility to apply different dresses (with different headers, and logos, and styles...) based on the context or the addressee of the document. I found v0.7.2 was nearly perfect to me, missing only the ability to compose a toc automatically. But maybe you've got different plans and different uses than mine in your mind. Thanks for your time and your efforts and best wishes.

mb21 commented 3 years ago

I'll add some way of doing it back, but I wasn't sure what the best way was. I've pushed a commit to the default-css branch (not very well tested yet), which allows you to place e.g.

header-includes: |-
  <style>
  p {
    font-weight: bold
  }
  </style>

in the file doc.yaml in the PanWriter User Data directory. The CSS should show up in the preview, just like it did in 0.7. If you can, please give it a try (see the build instructions).

andreagam commented 3 years ago

Hi Mauro, it's very kind of you. I will surely give it a try and let you know. Thank you so much for your help.

mb21 commented 3 years ago

I did some more testing and seemed fine, so just did a new release with this. Let me know if you find any bugs, thanks!