Giter VIP home page Giter VIP logo

Comments (7)

agoose77 avatar agoose77 commented on May 31, 2024

At present we use the existing JupyterLab scaffolding for Markdown rendering. This means that the Markdown renderer only sees the Markdown source, rather than the cell model. Because of this, it is not currently possible to access the cell through a plugin unless you do this yourself.

You could hack this in - the plugin mechanism is just a wrapper around the JupyterLab extension mechanism. You could write a more advanced extension that references the notebook tracker, and try to do some kind of lookup, but it would be fairly fragile.

from jupyterlab-markup.

agoose77 avatar agoose77 commented on May 31, 2024

In the long run, there is definitely scope for thinking about how cells should interact with Markdown rendering. There are already areas where this has interesting ramifications (https://github.com/agoose77/jupyterlab-imarkdown/)

from jupyterlab-markup.

psychemedia avatar psychemedia commented on May 31, 2024

... the Markdown renderer only sees the Markdown source, rather than the cell model.

Ah, ok... I think that's probably beyond my skillset atm. I did have a look at jupyterlab-imarkdown/ and will see if I can get get enough of a grip on it to strip it back to just giving me access to a cell / cell markdown, customising metadata on the basis of tag settings, and then seeing if I can just render that customised markdown.

from jupyterlab-markup.

agoose77 avatar agoose77 commented on May 31, 2024

Dragons beware! It's pretty gnarly code, mainly because JupyterLab's notebook rendering is not very customisable at the moment. jupyterlab-imarkdown overrides the machinery that returns a Markdown cell. It returns a special cell that listens for rendered markdown, and post-processes it to identify the special expression syntax. Meanwhile, there is a separate code path that evaluates the parsed cell expressions and replaces the placeholders in the HTML with the rendered results

from jupyterlab-markup.

psychemedia avatar psychemedia commented on May 31, 2024

Presumably the model.value.text is the original, raw markdown. When the markdown cell has rendered, can you also access the rendered output on the cell?

from jupyterlab-markup.

agoose77 avatar agoose77 commented on May 31, 2024

Unfortunately the cell content is not identical to the text given to the markdown renderer - we strip out the math expressions first.

When the markdown cell has rendered, can you also access the rendered output on the cell?

By default, no. That's what the imarkdown extension has to overload the cell class for.

from jupyterlab-markup.

psychemedia avatar psychemedia commented on May 31, 2024

The design of the notebook handler / renderer all seems completely messed up to me...

from jupyterlab-markup.

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.