mokeyish / obsidian-enhancing-export

This is an enhancing export plugin base on Pandoc for Obsidian (https://obsidian.md/ ). It's allow you to export to formats like Markdown、Markdown (Hugo https://gohugo.io/ )、Html、docx、Latex etc.
MIT License
326 stars 20 forks source link

add support for quarto #110

Open fcskit opened 1 year ago

fcskit commented 1 year ago

Would it be possible to add support for quarto (https://quarto.org) as an alternative to pandoc?

I played around with pandoc and quarto a bit in the last days and it seams to me that quarto is far more user friendly and supports more advanced formatting options (i.e. grid layout for images and tables, rendering of python, R, and other code) than pandoc and supports most of the pandoc options to be directly made in the yaml frontmatter (like selecting the type of output format and template). In particular the latter feels to me much more obsidian-like than having to create a hole set of different command templates.

mokeyish commented 1 year ago

Arbitrary commands are supported by design. You can try it out, but I'm out of energy.

If you want, I can guide you how to achieve it.

fcskit commented 1 year ago

Thank you for your reply. I'm currently also lacking a bit of energy.

I tried calling quarto form the plugin as suggested by you but struggled, since the enhancing export plugin lets me change the parameters that are passed to pandoc but not the pandoc command itself. So how could I call quarto directly?

Another issue is, that Quarto expects the input files to have .qmd as file extension not .md as used by Obsidian. So one would probably need to make a temporary copy of the input file with a .qmd extension and delete it after quarto has processed it. Maybe that could be solved by a small shell script that accepts the MD filename from the obsidian vault as input and then creates a copy that is processed by quarto and cleans up afterwards.

Any suggestions how to achieve this with the enhancing export plugin or would that need its own plugin?

FeralFlora commented 6 months ago

Thank you for your reply. I'm currently also lacking a bit of energy.

I tried calling quarto form the plugin as suggested by you but struggled, since the enhancing export plugin lets me change the parameters that are passed to pandoc but not the pandoc command itself. So how could I call quarto directly?

Another issue is, that Quarto expects the input files to have .qmd as file extension not .md as used by Obsidian. So one would probably need to make a temporary copy of the input file with a .qmd extension and delete it after quarto has processed it. Maybe that could be solved by a small shell script that accepts the MD filename from the obsidian vault as input and then creates a copy that is processed by quarto and cleans up afterwards.

Any suggestions how to achieve this with the enhancing export plugin or would that need its own plugin?

Did you do this with a new custom command template?

fcskit commented 6 months ago

I used the shell commands plugin of obsidian and set up the following script:

mkdir -p path_to_temp_dir/{{title}}
cp {{file_path:absolute}} path_to_temp_dir/{{title}}/{{title}}.qmd
 path_to_quarto_dir/bin/quarto render path_to_temp_dir/{{title}}/{{title}}.qmd > path_to_temp_dir/{{title}}/{{title}}.log 2>&1