Code Monkey home page Code Monkey logo

Comments (6)

chengfeng-liu avatar chengfeng-liu commented on August 16, 2024 1

Great! Thank you so much for looking at it.

I am a heavy user of pretty jupyter and I also found, I think, a minor flaw that the generated html has a huge space of blank at the end. I am not sure if you call it an issue, but I think the generated html would look better without the blank space at the end.

Thank you again for your time and your package,
Best wishes

from pretty-jupyter.

JanPalasek avatar JanPalasek commented on August 16, 2024

Hello. Sure. I'll look into it asap.

from pretty-jupyter.

JanPalasek avatar JanPalasek commented on August 16, 2024

Thank you for reporting it. I managed to reproduce the issue and I'm looking into it.

from pretty-jupyter.

JanPalasek avatar JanPalasek commented on August 16, 2024

I found the problem. The problem is on the side of nbconvert. It cannot handle HTML properly when embed_images is turned on.

The problem is because of the following steps:

  1. pretty-jupyter transforms [//]: # (-.- .tabset) into <span class="pj-token" style="display: none">
  2. nbconvert (if embed_images is turned on) in IPythonRenderer.inline_html loads first part of the span (due to tokenization) as <span class="pj-token" style="display: none">.
  3. If embed_images is turned on, it tries to load it as html using beautiful soup package and then replace the sources with the embedded strings. However when loading it, it "fixes" the html and fills the closing tag for the span => <span class="pj-token" style="display: none"></span>.
  4. Then the problem snowballs. Now the span is already closed, so it needs to handle ".tabset" text token. So it just appends it after the span etc.

This problem has a simple fix. If the token in IPythonRenderer.inline_html does not contain any image tag, the inline_html shouldn't return html parsed for images.

@chengfeng-liu All in all, I know how to fix it in nbconvert package. I'll try to create a merge request to nbconvert asap. Just need to create minimal reproducible example before that explaining why they should want the change.

from pretty-jupyter.

JanPalasek avatar JanPalasek commented on August 16, 2024

Temporary solution:

Try to install nbconvert < 7.0.0. I tried version 6.5.4 and it works with no issues.

from pretty-jupyter.

JanPalasek avatar JanPalasek commented on August 16, 2024

@chengfeng-liu I created issues in nbconvert's repository. I found more issues in the >=7 version of nbconvert, therefore in the new version I limit the required nbconvert's version to <7 in the new release.

I'll be closing this issue since the problem is not in this repository.

from pretty-jupyter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.