Skip to content

ipynb reader fails on execute_result with null execution_count #12008

Open

Description

@JayOfTheKeyboard
% pandoc -v | head -1
pandoc 3.13
% pandoc -f ipynb -t markdown null-ec.ipynb
ipynb decoding error: Error in $: expected nbformat <= 3

The input is the same as in the PR above. The nbformat v4 schema allows "execution_count": null on an execute_result, but Data.Ipynb has executeCount :: Int. The v4 parse fails, so the error shown comes from the v3 fallback. nbformat.validate accepts the file. I expected the notebook to convert, with no execution_count attribute on the output div.

jgm/ipynb#4 changes executeCount to Maybe Int. On the pandoc side, the writer then fails to compile at fromMaybe 0 (drop it). The reader still compiles, but it would write execution_count="Just 3", so outputToBlock needs maybe [] (\n -> [("execution_count", tshow n)]) ec in place of [("execution_count",tshow ec)].

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions