-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Pandoc template support #31
Comments
For what it's worth, I'm pretty sure that the templates I personally need are here: https://github.com/prosegrinder/pandoc-templates Of course I have no idea how to get them to work because the windows directions are under revision :P but I thought maybe his might help? |
Thanks, I'll use that to test the feature when I'm done. Hopefully you'll be able to just copy the files from that repo into your vault to use them as templates when I'm done |
This is now possible, using the As for the writing templates you've posted @eleanorkonik, it looks like they're scripts that wrap around Pandoc so you can't use them directly as Pandoc templates. I think they need to be invoked in the terminal directly. Any issues/confusions about templates in this plugin should be appended to this issue for now |
What about having a template: in the YAML front matter. For example, saying: ---
template: local.latex
--- would be the same as |
Hello, Regards, PS. For now, I entered extra pandoc commands to output citations using the mla format and to specifically use a template. I'm sharing it here to help others who might be in the same boat. --metadata bibliography=/Users/username/Dropbox/library.json |
I can't seem to get a custom template to work. If I run pandoc vanilla, it's just fine, but as soon as I enter "--template ms-template" into the settings, I get an encoding error (attached screen). It looks like there is something wrong in the document (also attached) But it was generated by Obsidian pandoc. All I did was tweak a few paragraph styles (font color, size, alignment, spacing, and page breaks) in Libreoffice, created the directory in my home folder ~/.pandoc/templates, and put the file there. So I'm not sure how I can be messing this up. And the template works in Typora--which is a work around for now of course, but why leave Obsidian if I don't have to? |
Hey Guys, any Ideas? |
the same problem, in extra Pandoc arguments added something like: --reference-doc Users/lars/Documents/myref.docx |
I can define a new template for latex documents, but if I create a PDF using Latex this template is not used. It seems to find some default template which is different to that in ~/.pandoc/templates/ I am very confused. Any ideas |
@OliverBalfour @kelleyskovron Did you ever resolve this issue? I'm having the same error. I'm using the prosegrinder .docx template that @eleanorkonik linked above |
the same problem, discussed here https://forum.obsidian.md/t/custom-word-template-with-pandoc-pluugin/41685/11 still looking for solution |
This would be a very simple solution that I agree would be incredibly useful. |
@Ellpeck what happens if you do this? IIRC this should work, although you might need to do something like If it doesn't work using an absolute path that's a bug, if it does then I need to add better documentation because this is pretty non-obvious. |
I've only tried with a URL (which works with the --template pandoc argument and, imo, should work with this plugin too), and that doesn't make a difference at all. It doesn't seem to be picked up by the plugin or by pandoc, and so the template isn't applied. Unless you mean with an updated dev version? I've only tried with 0.4.1, which is the most recent public version. |
@Ellpeck yeah that's very strange. The plugin doesn't treat the |
@Ellpeck Do you have spaces in your absolute path to the template, that you wouldn't have in your path to other metadata CLI options ? |
As I said, the only time I tested this, I used a web URL (which is supported by the |
Hi. I am configuring Obsidian to reproduce some features of Zettlr that I like, including Zettlr's pandoc handling. --defaults=C:\Users\fleng\AppData\Roaming\Zettlr\defaults\export.latex.yaml --bibliography C:\Users\fleng\Dropbox\Zettelkasten\media\MyLibrary.json in the Extra Pandoc arguments option, whereas to export to pdf with pdflatex, I need to change the Extra Pandoc arguments to --defaults=C:\Users\fleng\AppData\Roaming\Zettlr\defaults\export.pdf.yaml --bibliography C:\Users\fleng\Dropbox\Zettelkasten\media\MyLibrary.json The export files I use are in my github under flengyel/Zettel, as is the latex template, which is invoked by the export files. The point is that the plugin might include separate command line argument for each of the output formats, since the defaults may change. Maybe I will modify the plugin for these cases myself. Many thanks for your work. |
Finally figured out what it was, and as I feared, it was just me missing something that was obvious once I took the time to drill far enough into the Pandoc user guide. Basically, you don't use the 'template' command for docx, but instead 'reference-doc'. As such, it's not looking for a file in the templates folder. If you drop the file directly in /home/.pandoc (assuming that's where your user data directory is located) and name it 'reference.docx', then it works right out of the box, no extra arguments needed in Obsidian. I generated a reference file directly from pandoc per these instructions and customized it myself based on my editor's preferences. |
I'm JUST starting to explore the use of this plugin, but am completely intimidated by all of it.
Thanks for any help! |
I'm not a programmer, but I did spend some time as a technical writer, so I have some familiarity with it all. I will endeavor to help as best I can. The following assumes you are only looking to export a markdown file to docx. Other export formats require a different setup. This also assumes that you have already installed both Pandoc and the Pandoc plugin for Obsidian on your computer.
And that's all there is to it. There are some additional things I recommend, such as create a custom hotkey for the plugin export to docx command in Obsidian, and creating a symlink/alias to your reference.docx file in your Obsidian template folder so you don't have to show hidden files every time you want to open the .pandoc folder to alter your template. But these are nonessentials that I have merely found make the workflow a little more smooth. Good luck! |
Wow! Thanks! I'm quite familiar with Windows and such, but Pandoc and LaTex is just too much programming for me. Turns out the reason I couldn't find the Pandoc folder under AppData is because I forgot to install it. Since I was using the HTML output in Obsidian, I never went through with the actual install. Woops. Now it's installed, I put the file my university sent me as a template (it's a docx) file and renamed it reference.docx I wish the math department would hurry up and update the LaTex template as I could possibly just use that, but that might be asking for a too big learning curve considering the time I have left... Thank you so VERY MUCH for your very detailed input! |
I CREATED a new folder in ROAMING (the default install is in Local) and THAT worked. It's not perfect (still have to check other styles (tables, figures, etc) but I'm on the right track. Thank you!! |
Were you able to solve this issue? I am facing the same problem. |
On my windows computer, the Installation Wizard always installed the pandoc program into my User\AppData\Local\Pandoc directory and not in the said .pandoc folder. What worked for me was to just copy and paste the whole path of the template, inside the settings in Obsidian: --template C:\your whole path to the template you want to use\template.tex after that it uset my wished template Now I have to generate my wished template. |
Can we have this please? |
I think this could be combined with new "autocomplete" feature of obsidian properties. |
Requested by @eleanorkonik on the Discord's #creative channel
Basically, you can write template files for most output formats which use a templating language to include bits of the input document. Using the Pandoc CLI the command will have a
--template=file.tex
if you've got a template calledfile.tex
in the working directory or~/.pandoc/templates
.My idea for the UX is to have a setting where you list files anywhere in your vault that you'd like to be templates (or specify a template directory?). Then, when you export, if there are any custom templates for that export type you should be prompted for the template you want, including the default one.
Related links:
The text was updated successfully, but these errors were encountered: