New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add no-attachments extension to ipynb format. #8432
Comments
This could be addressed by handling the error raised by fetchItem. Would that be a simpler approach than adding a new extension? |
Well, the error is simply I am thinking about a nasty filter which converts images to links with a |
I turned out, that a simple filter can be used. Shame on me! I am closing this as no changes needed. imageToLink :: Pandoc.Block -> Pandoc.Block
imageToLink (Pandoc.Para (Pandoc.Image attrs inl target:is)) = Pandoc.Para $ Pandoc.Str "!":Pandoc.Link attrs inl target:is
imageToLink i = i |
Why not? We could handle the error by just including a regular image link with that path, and issuing a warning.
fetchItem can be used with runPure. It won't do any actual IO, but it will still look in the ersatz file system, and it will raise an error if nothing else -- which can be trapped. Let's keep this open. |
Maybe I am a little bit lost, are you proposing to actually change the code so Comming back to |
Describe your proposed improvement and the problem it solves.
By default,
pandoc
will create attachments for image links when writingipynb
as stated by the documentation. The waypandoc
creates those, is via addAttachment function in theIpynb
writer. Such a function depends on fetchItem which as far as I can tell is meant to read the rawByteString
from file system.This has two problems:
pandoc
library, thenPandoc.runPure
can't simply work, becausefetchItem
can't do anyIO
to grab the raw bytes of the image. This is shown in the example below, in whichrunPure
fails butrunIO
doesn'tI think this change could by adressed by changing function extractCells so instead of calling
addAttachment
it checks first if the extension is enable. If it is, then do not modify theInline
, else modify it. This will create a regularmarkdown
imagen link instead of an attachmentI think I can implement this change if you confirm this is the way yo go.
Describe alternatives you've considered.
I read the documentation looking for other options to achive this or manipulating the raw
Text
produced bywriteIpynb
(I am working with pandoc the library)The text was updated successfully, but these errors were encountered: