mb21 / panwriter

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

Support customized export command #75

Open fyuniv opened 2 years ago

fyuniv commented 2 years ago

Is it possible to add a feature for customized exporting like Typora? Since Pandoc support default.yaml, this feature will make exporting more powerful. Thank you!

mb21 commented 2 years ago

What exactly do you want to customize that you currently cannot? Have you read the README?

fyuniv commented 2 years ago

What exactly do you want to customize that you currently cannot? Have you read the README?

My bad, I didn't know that the defaults.yml will be automatically handled by Panwriter. Now I feel much better to recommend it to others.

Other things that I was thinking about is to run some simple commands, such as, git commit, or hugo, in Panwriter. Can this feature be added in future versions? Thank you!

mb21 commented 2 years ago

run some simple commands, such as, git commit, or hugo, in Panwriter

hm.. I was thinking of keeping PanWriter focused on the writing experience and calling pandoc... but if enough people are interested in this, could think of a way to add it that doesn't bloat the code and the GUI too much...

fyuniv commented 2 years ago

run some simple commands, such as, git commit, or hugo, in Panwriter

hm.. I was thinking of keeping PanWriter focused on the writing experience and calling pandoc... but if enough people are interested in this, could think of a way to add it that doesn't bloat the code and the GUI too much...

Thank you in advance! The reason I asked for customized commands is to make the editor self-contained for creating and publishing webpages or slides. It will help new users of markdown to get work done without running command in command line or using another App.

mb21 commented 2 years ago

We could read out a special key from the document's YAML metadata, which would override the default export command, which is currently simply pandoc, so you could do:

---
export: './run.sh'
---

# my markdown doc

but it would then be up to the run.sh to handle all the same arguments pandoc accepts (potentially passing them on to pandoc).

Also not sure of the security implications of this... users could be easily tricked into opening a malicious document in PanWriter, clicking file -> export, and having arbitrary code executed on their system, we probably would have to put a warning dialog up once per document (and also show that when using a pandoc filters or a custom writer).

AkechiShiro commented 2 years ago

Hey any news on this feature or any related PR ? If I have some time, I may try to land a PR in after the month of May, anyone willing to help me with that ?

mb21 commented 2 years ago

No code written yet, but discussion or even PRs welcome! So far I've been mostly waiting on feedback on whether the proposal in my last comment here would satisfy users' needs...

AkechiShiro commented 2 years ago

On my end it would satisfy me as long as I can use a custom template, although I would probably work on panwriter's preview feature to try and support custom pandoc templates too but I hvae no idea how hard or even if that is currently doable, I'm not familiar with the tech stack used by panwriter to preview markdown.