Pandoc plugin combining documents

Things I have tried

Read the instructions for using the Pandoc plugin to combine different Obsidian notes into one document, for example Markdown or PDF:

https://github.com/OliverBalfour/obsidian-pandoc/wiki/Combining-Documents

Specifically: " You can embed notes in other notes using ![[note name]] syntax." Within Obsidian, this works; f I put “![[NoteB]]” in NoteA, I see the text of NoteB in NoteA.

But when I invoke the plugin to export as markdown or PDF, I just get the link to NoteB, in NoteA, not the text. It’s treating “![[NoteA]]” (the inclusion) as if it’s “[[NoteA]]” (the link).

What I’m trying to do

I have one Obsidian note per chapter of a book, and want to combine them into one PDF (including images). I have managed to get images working in PDF export (even with spaces in filenames, following instructions by ndegroot here: https://github.com/OliverBalfour/obsidian-pandoc/issues/81). But I can’t the transclusion / inclusion of one note in another working.

1 Like

Does anything in Bug: Combining Documents before conversion does not work · Issue #54 · OliverBalfour/obsidian-pandoc · GitHub help?

Yes, or at least it explains the problem:

  • there is an option to export from HTML or from Markdown.
  • inclusion works with export from HTML, but not from Markdown
  • However, you need to export from Markdown to get citations working.
  • also, switching to export from HTML breaks image inclusion, for me. In the same thread you referred me to, laurentbonnet also notes that export from HTML breaks image inclusion, saying that it is because his images are not located in the root directory. However, mine are in the root directory, so I’m not sure what’s going on there.

I guess the solution for the moment is to export individual chapters, then merge the PDFs (e.g. so that I can do full-text search on the whole manuscript).

Thanks for your help.

Andrew

1 Like

It occurred to me that there is a two-step solution. First, choose the “export from HTML” option, in the Pandoc Plugin options, then pick the “Export as Pandoc Markdown” command. That gets the inclusion working. Second, navigate to the resulting markdown note in Obsidian (having left the “Export Folder” option in the Pandoc Plugin to the default “same as target”). This note will now contain the full text of all the included notes. Third, change the Pandoc Plugin option back to “export from Markdown”, then pick the “Export as PDF (via Latex)” option.

Actually, there were a couple of other intermediate steps. First, converting (from HTML) to markdown (to get the inclusion), lost the metadata where I provide the location of my bib file (“bibliography: nameofmybibfile.bib”), so I had to reinsert that, to get citations working again. Second, the markdown file had a lot of "" characters (around my citations) that seemed to be messing up the conversion to PDF, so I just deleted them.

That’s a bit complicated, but not too bad. Now I have a PDF of the whole manuscript, with a list of incorrect citations in the log file.

1 Like

My second intermediate step above was incorrect. The initial conversion to markdown does insert a lot of backslashes. This doesn’t interfere with the conversion to PDF – I had forgotten to switch back to exporting from markdown, as opposed to from HTML. However, the extra backslashes do mess up the formatting of some citations, specifically those with multiple items, e.g. [@foo;@bar].

You may be interested in this request:

Thanks!

Thanks, I hadn’t seen that thread. Agree with this from Dor:

“Obsidian’s setup encourages writing in shorter notes, but using them often requires combining them”.

For my case – book manuscript with 8 chapters – the simplest approach is to create a note that contains

![[Chapter 1]]
![[Chapter 2]]
etc.

and then “export to PDF”.

However, that doesn’t do citations, and the resulting PDF has no chapter markers or page numbers.

The pandoc approach involves three steps:

  1. use the plugin to export from HTML to markdown
  2. search and replace the extra backslashes that interfere with citations
  3. use the plugin to export from markdown to pdf

What results is a nice-looking PDF with chapter markers and page numbers. In fact, it has a full table of contents, including all headings and sub-headings. Now I can proof and search the full document to find where I said what. I haven’t figured out cross-references yet.

1 Like

Hi all!

I´m quite new here and just started learning Obsidian.
Is the webpage from github.com/OliverValfour/obsidian-pandoc (Pandoc - Installing pandoc)safe - can I trust the download there? Because I have to confirm that there always can be a virus in exe-files.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.