YAML is not entirely read when using Pandoc plugin. TOC is included, but citations, and images not rendered, and specified template not used

Things I have tried

  • Checked all ‘pandoc and workflow tutorials’ on the Obsidian Hub for academic writing and other non-obsidian related pandoc tutorials and issues on youtube, github, and stackoverflow. (I even get a message that I have visited the manual many times :sweat_smile: )
    image

  • put the bibliography, csl, and template files in the pandoc directory C:\Users\joris\AppData\Roaming\pandoc. When that did not work, I used the relative and finally absolute paths to the .json, .csl, and .dot files (which worked when exporting via powershell as indicated below)

  • bibliography, csl, and template files are working by using Powershell and highlighted text in screenshot below to export a test file

  • used powershell to confime the latest Pandoc version is used

PS C:\Users\joris> pandoc --version
pandoc.exe 2.19.2
Compiled with pandoc-types 1.22.2.1, texmath 0.12.5.2, skylighting 0.13,
citeproc 0.8.0.1, ipynb 0.2, hslua 2.2.1
Scripting engine: Lua 5.4
User data directory: C:\Users\joris\AppData\Roaming\pandoc
Copyright (C) 2006-2022 John MacFarlane. Web:  https://pandoc.org
This is free software; see the source for copying conditions. There is no warranty, not even for merchantability or fitness for a particular purpose.
  • confirmed that
    • the right variables are used in YAML, by checking the pandoc manual
  • valid YAML is used by checking the formatting with YAML Lint

What I’m trying to do

I try to export drafts and manuscripts to a project-specific export folder by inserting a project-specific YAML template (specifying the title, date, author, bibliography, citation style, template file, export folder).

Reason: I often share drafts or entire manuscripts for projects that require different formatting.

I am trying to:

  • write in Obsidian (1.1.9), installed on Windows 11 Pro (22H2),
  • cite [@citekey] using Citations plugin (0.4.5), and Zotero (6.0.19) with BetterBibText (6.7.43).
  • order and compile scenes using Longform (2.0.0)
  • convert links to markdown with Obsidian Link Converter (0.1.4)
  • use templater to insert project-specific YAML (i.e. specifying the appropriate title, date, author, bibliography, template file, and citation style).
---
title: test
toc: true
toc-own-page: true
metadata: 
  bibliography: "C:/Users/joris/Documents/!Vault/References/MyLibrary.json"
  csl: "C:/Users/j/Zoterostyles/multidisciplinary-digital-publishing-institute.csl"
  link-citations: true
  link-bibliography: true
  template: "C:/Users/joris/OneDrive/11 Research/_Journal Selection/MDPI
  -Sustainability/sustainability-template.dot"
data-dir: *would be set to the project folder so that others may continue the work easily if the project folder is shared, in previous attempts this variable was excluded when using the absolute paths* 
linenumbers: true
wordcount: "X"
---
  • Use hotkey (ctrl + W) to export manuscripts to specified export folder using the Pandoc plugin (0.4.1) and Pandoc (2.19.2)

The image is not included because a “Permission denied” error:

@Moonbase59 and @pseudometa, do you perphaps know how to fix these issues? Your comments on the Obsidian and Github forum make me quite confident that you can answer one or both questions below.

  1. Why is the bibliography, citation style, and template used when exporting via Windows Powershell, but not when using YAML?
  2. How can I resolve the “Permission denied” issue so that images can be rendered?

Of course, I’d be happy to provide more info if that’s helpful.

Do you need to use backslashes (\) instead of slashes (/) in those file paths?

Thank you for replying. I’ve tried it but it does not seem to work.

Input:

Output:


TOC works, but references are not rendered

When checking this YAML in YAMLlint, I get errors.

The inputs (.json, .csl, .dot) do work when used via Powershell, so I don’t know why the YAML partly works.

Ah, looks like it’s using backslashes as escape characters (as in the common \n which means “newline”). Try doubling the backslashes \\ (thus escaping the escape character, producing a literal backslash).

Also, here’s a general guide to YAML syntax (from Wikipedia because the official one is hard to read): YAML - Wikipedia

Thank you for the guide, and good to know what \n means. Now I know how to compile notes in longform with less space in between (:

The double backslash does not work. With or without the " " encapsulating the path does not make a difference.

Input:

---
toc: true
toc-own-page: true
bibliography: "C:\\Users\\joris\\Documents\\!Vault\\References\\MyLibrary.json"
csl: "C:\\Users\\joris\\Zoterostyles\\multidisciplinary-digital-publishing-institute.csl"
template: "C:\\Users\\joris\\OneDrive\\11 Research\\_Journal Selection\\MDPI-Sustainability\\sustainability-template.dot"
linenumbers: true
link-citations: true
link-bibliography: true
wordcount: "X"
--- 

Output:

What is the actual name of your template? Your using two different names, with and without spaces?

And the warning you’re listing is not named in the text you provide, so how is it connected? What’s the full name of that file? Do you simply have an issue with how spaces are handled in file names?

The full template name is “t.11. YAML manuscript MDPI”, which I insert in my test file “tst.md”.

The “warning” is actually a description listed, but hidden in the text. I’ve highlighted it in red.
image

The file names work if I export via Powershell, so the spaces are not an issue there. In the YAML, I do not get any errors in when checking with YAMLlint. Then it remarks multiple files are included. The " " should prevent errors with spaces right?