max-heller / mdbook-pandoc

A mdbook backend powered by Pandoc.
Apache License 2.0
97 stars 7 forks source link

Pandoc error withBinaryFile #81

Closed pepijnvtol closed 5 months ago

pepijnvtol commented 5 months ago

Hi,

At this moment I have the most simple example. What I did was:

mdbook init test_mdbook_pdf
>>> Do you want a .gitignore to be created? (y/n)
>>> y
>>> What title would you like to give the book? 
>>> test book
[INFO] (mdbook::book::init): Creating a new book with stub content

cd test_mdbook_pdf
mdbook serve

Yes this worked, the default book showed (with 1 chapter)

cargo install --git https://github.com/max-heller/mdbook-pandoc.git mdbook-pandoc
# book.toml
[book]
title = "test book"

[output.pandoc.profile.pdf]
output-file = "output.pdf"
to = "latex"

Then I run mdbook build and get these info and error messages:

2024-03-28 16:28:45 [INFO] (mdbook::book): Book building has started
2024-03-28 16:28:45 [INFO] (mdbook::book): Running the pandoc backend
2024-03-28 16:28:45 [INFO] (mdbook::renderer): Invoking the "pandoc" renderer
pandoc: book\pdf\src\chapter_1.md: withBinaryFile: invalid argument (Invalid argument)
pandoc exited unsuccessfully
2024-03-28 16:28:45 [ERROR] (mdbook::renderer): Renderer exited with non-zero return code.
2024-03-28 16:28:45 [ERROR] (mdbook::utils): Error: Rendering failed
2024-03-28 16:28:45 [ERROR] (mdbook::utils):    Caused By: The "pandoc" renderer failed

What can cause this error?

Running windows 10

>>> pandoc --version
pandoc.exe 3.1.9
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: C:\Users\USER_NAME\AppData\Roaming\pandoc
Copyright (C) 2006-2023 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.
max-heller commented 5 months ago

This seems to be a result of https://github.com/rust-lang/rust/issues/42869 and should be fixed by #84

max-heller commented 5 months ago

Fix released in 0.6.4. I no longer encounter the error locally, but let me know if you continue seeing it

pepijnvtol commented 5 months ago

The new version also solved the issue on my machine. Thank you.