dexplo / dataframe_image

A python package for embedding pandas DataFrames as images into pdf and markdown documents
https://dexplo.org/dataframe_image
MIT License
282 stars 41 forks source link

Strange markdown convertion behavior #53

Closed keufran closed 2 years ago

keufran commented 2 years ago

Hi,

Thanks for your work, very useful to me.

When using dataframe_image to produce a markdown conversion of my notebooks, I notice that part of the markdown result is ... html (paragraphs, sections, ...) !

I looked at the source code but I'm not familiar with the usage of nbconvert as a library.

All I can say is that a MarkdownExporter is used but before that a MarkdownPreprocessor is called. If I remove it, my problem is solved.

I guess that Preprocessing of MarkDown cells is needed when rendering to latex/pdf, but I think it is unecessary when rendering to markdown.

A simple fix in convert() from _convert.py function would be (line 327 in master):

if "md" not in self.to:
    MarkdownPreprocessor().preprocess(self.nb, self.resources)

What do you think about it ?

If you wish, I can do a PR. I have never done that before but it's an opportunity to learn :)

PaleNeutron commented 2 years ago

Can you upload a notebook facing this problem? It will help us to run test withit to figure out the problem.

keufran commented 2 years ago

Sorry for the delay, but here it is.

minimal_markdown.zip

PaleNeutron commented 2 years ago

@keufran , thanks for reporting this bug, it have been fix in the latest version.

Please try to install version 0.1.3 and see if the bug still exist.

keufran commented 2 years ago

It works, thank you !