question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pandoc crashes if I try to replace an image

See original GitHub issue

I’m writing a filter for pandoc, but if I try to remove images I get an error. Here’s a minimal filter:

from pandocfilters import toJSONFilter, RawBlock


def filter(key, value, format, meta):
    if key == 'Image':
        return RawBlock('html', 'ok')


if __name__ == "__main__":
    toJSONFilter(filter)

Here’s the error:

pandoc: Error in $.blocks[17].c[0]: failed to parse field blocks: failed to parse field c: mempty
CallStack (from HasCallStack):
  error, called at pandoc.hs:144:42 in main:Main

I call pandoc without any extra options, just --filter my_filter.py and -o output.html.

Version:

pandoc 1.19.2.1
Compiled with pandoc-types 1.17.0.4, texmath 0.9, skylighting 0.1.1.4

on Windows 10 x64

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jgmcommented, Dec 1, 2017

Oh, the problem is that you use RawBlock instead of RawInline. An image is an Inline. Sorry, this library doesn’t have very good error reporting. You might try panflute instead!

0reactions
mtomassolicommented, Dec 2, 2017

I solved by replacing the containing Para. Thanks for the help and the library!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Releases - Pandoc
Prevent crashing when handling invalid tables (Albert Krewinkel, #8102). Tables with different numbers of cells per row would sometimes crash pandoc. This fix ......
Read more >
Image file path error while using pandoc for markdown to pdf ...
I just tried it with the MRE being just a line specifying the image. When the image was in the current working directory,...
Read more >
15 Common Problems with rmarkdown (and some solutions)
To avoid problems in the first place, I try and do the following: Develop code in chunks and execute the chunks until they...
Read more >
Document crashing LibreOffice Writer since upgrade to 7.2.0.4
What we are trying to do here is to either confirm the problem is with the program or the document. You could try...
Read more >
Chapter 20 Make it fancier | rstudio4edu - GitHub Pages
You'll get the most out of this chapter if you read through the CSS crash course ... Insert the following, replacing favicon.ico with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found