obsidian-enhancing-export
obsidian-enhancing-export copied to clipboard
Export to .pdf only when YAML is deleted?
If I export a note to .pdf, I use this YAML in the note:
---
aliases: [ToDo]
tags: [ToDo, HH23AB, KA01, KA02, KA03, KA04, KA05, KA06, KA07, HH, CT23A, CT, FW23A, FW22A, FW21A, FW, Kritisch]
Dateiname: MarkorToDo.md
filename: MarkorToDo
filenamemd: MarkorToDo.md
filenamemd2: H:\Syncthing\Obsidian/MarkorToDo.md
template: [TEMPLATE Neue Notiz]
erstellt: Samstag, 17. Juni 2023, 19:43:23 Uhr
geändert: Sonntag, 25. Juni 2023, 18:15:30 Uhr
---
The export changes this to
---
aliases:
- ToDo
tags:
- ToDo
- HH23AB
- KA01
- KA02
- KA03
- KA04
- KA05
- KA06
- KA07
- HH
- CT23A
- CT
- FW23A
- FW22A
- FW21A
- FW
- Kritisch
Dateiname: MarkorToDo.md
filename: MarkorToDo
filenamemd: MarkorToDo.md
filenamemd2: H:\Syncthing\Obsidian/MarkorToDo.md
template:
- TEMPLATE Neue Notiz
erstellt: Samstag, 17. Juni 2023, 19:43:23 Uhr
geändert: Sonntag, 25. Juni 2023, 18:15:30 Uhr
---
Why does it change the markdown file?
The process ends to this output:
When I delete the YAML, I can export to pdf.
These are my settings:
C:\Users\uwewe\AppData\Local\Pandoc\pandoc.exe
-f markdown --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/pdf.lua" --embed-resources --standalone --metadata title="${currentFileName}" -s -o "${outputPath}" -t pdf
(I alway use newest obsidian, newest pandoc and newest plugins.)
Where is this template you are linking to?
The template only says from which template (TEMPLATE Neue Notiz) this file was made from. There is no link.
Sorry I misunderstood the question. We just introduced a template function but it is unrelated to this problem I think.
@mokeyish may be better suited to help.
Please try to add newline after YAML?
A new line makes no difference.
This file works:
---
aliases:
- Notiz
tags:
- Notiz
Dateiname: Export plugin testfile.md
filename: Export plugin testfile
filenamemd: Export plugin testfile.md
filenamemd2: H:\Syncthing\Obsidian/Export plugin testfile.md
erstellt: Montag, 26. Juni 2023, 14:34:19 Uhr
geändert: Montag, 26. Juni 2023, 14:39:27 Uhr
---
## 1 Export plugin testfile
## 2 Inhaltsverzeichnis ^toc
- [[#1 Export plugin testfile|1 Export plugin testfile]]
- [[#2 Inhaltsverzeichnis ^toc|2 Inhaltsverzeichnis]]
- [[#3 ErsteÜberschrift|3 ErsteÜberschrift]]
- [[#4 Export plugin testfile|4 Export plugin testfile]]
- [[#5 ErsteÜberschrift|5 ErsteÜberschrift]]
- [[#6 Export plugin testfile|6 Export plugin testfile]]
- [[#7 ErsteÜberschrift|7 ErsteÜberschrift]]
## 3 ErsteÜberschrift
## 4 Export plugin testfile
## 5 ErsteÜberschrift
## 6 Export plugin testfile
## 7 ErsteÜberschrift
But this file works not:
---
aliases: [Notiz]
tags: [Notiz]
Dateiname: Export plugin testfile.md
filename: Export plugin testfile
filenamemd: Export plugin testfile.md
filenamemd2: H:\Syncthing\Obsidian/Export plugin testfile.md
template: [TEMPLATE Neue Notiz]
erstellt: Montag, 26. Juni 2023, 14:34:19 Uhr
geändert: Montag, 26. Juni 2023, 14:42:46 Uhr
---
## 1 Export plugin testfile
## 2 Inhaltsverzeichnis ^toc
- [[#1 Export plugin testfile|1 Export plugin testfile]]
- [[#2 Inhaltsverzeichnis ^toc|2 Inhaltsverzeichnis]]
- [[#3 ErsteÜberschrift|3 ErsteÜberschrift]]
## 3 ErsteÜberschrift
## 4 Export plugin testfile
## 5 Inhaltsverzeichnis ^toc
- [[#1 Export plugin testfile|1 Export plugin testfile]]
- [[#2 Inhaltsverzeichnis ^toc|2 Inhaltsverzeichnis]]
- [[#3 ErsteÜberschrift|3 ErsteÜberschrift]]
- [[#4 Export plugin testfile|4 Export plugin testfile]]
- [[#5 Inhaltsverzeichnis ^toc|5 Inhaltsverzeichnis]]
- [[#6 ErsteÜberschrift|6 ErsteÜberschrift]]
- [[#7 Export plugin testfile|7 Export plugin testfile]]
- [[#8 ErsteÜberschrift|8 ErsteÜberschrift]]
- [[#9 Export plugin testfile|9 Export plugin testfile]]
- [[#10 ErsteÜberschrift|10 ErsteÜberschrift]]
## 6 ErsteÜberschrift
## 7 Export plugin testfile
## 8 ErsteÜberschrift
## 9 Export plugin testfile
## 10 ErsteÜberschrift
The only difference is this line:
template: [TEMPLATE Neue Notiz]
Please try wrapping TEMPLATE Neue Notiz in double quotes, or insert a comma between them.
I am not able to reproduce on my machine. Also tried templates. Could it be something related to Windows?
Perhaps, can you try without YAML to see if the problem persists?
https://www.w3schools.io/file/yaml-arrays/
When I try to make a pdf-file from this, I get this error message:
The resource-path="H:\Syncthing\Obsidian\attachments" seems to be wrong. There is no such path. I have these settings for Defalut location for new attachments:
What else I did:
I reinstalled pandoc. It lives here:
I installed MikTex (is this necessary?)
pandoc -v gives
path gives this:
What can I do, to solve the issue?
Hi @merlinuwe ,
Can you please install: https://miktex.org ?
I tested your code on windows (the one you said does not work and I was able to produce the attached PDF Untitled.pdf
Also I am not sure I follow this "The resource-path="H:\Syncthing\Obsidian\attachments" seems to be wrong. There is no such path. I have these settings for Defalut location for new attachments:"
In the screenshot you posted, you clearly show that Obsidian will add attachments to the "Attachments" folder:
if that folder does not exist, maybe it interferes with you creating documents with images. Either create it and move your images there or modify that field with the folder where you keep your images. (or add your image path to the resource path in Obsidian Enhancing export)
Try add ./ before your attachmentPath?
https://github.com/mokeyish/obsidian-enhancing-export/blob/8bec93ac2a831296157c066a531549c5eabdc8c0/src/exporto0o.ts#L68-L73
Can you please install: https://miktex.org ?
@universvm Hi, Wouldn't it be better to make a Typst template? https://typst.app/
Typst is easy to install like the pandoc. a single file executable binary(https://github.com/typst/typst/releases).
It can even be added to automatically download the latest pandoc and typst programs from Github, so that no additional installation is required.
Can you please install: https://miktex.org ?
@universvm Hi, Wouldn't it be better to make a Typst template? https://typst.app/
Typst is easy to install like the pandoc. a single file executable binary(https://github.com/typst/typst/releases).
It can even be added to automatically download the latest pandoc and typst programs from Github, so that no additional installation is required.
I haven't tried it yet, not sure when I'll have time to. It seems promising.
@merlinuwe
I've add better printing of generated export command and options.
https://github.com/mokeyish/obsidian-enhancing-export/blob/e64211c4d4f9aad24c902c46dad5f5d63bc834e1/src/exporto0o.ts#L176-L179
Please use the shortcut Ctrl+Shift+I or the F12 key to open DevTools in the Obsidian to see it.
Then extract the generated command and environment variables, then in cmd/bash , configure the environment variables and execute it.
If so, you can see what the problem is, or go to the pandoc community to see how to solve the problem.
If it is found that the generated command is wrong or there is a problem with the environment variable, you can raise it and we will fix it.