notebook icon indicating copy to clipboard operation
notebook copied to clipboard

Support for mdx instead of markdown

Open arindampradhan opened this issue 1 year ago • 1 comments
trafficstars

Hi I need to render some react components which are already supported in mdx, it would be wonderful if I could pass data from python numpy to my react component in mdx in jypyter to render graphs

Problem

Integration with mdx: https://github.com/mdx-js/mdx

[py]

import numpy as np
import globals

data = np.array.rand(2,3)


globals.data = data

[mdx]

import {Chart} from './snowfall.js'
export const year = 2013

# Last year’s snowfall

In {year}, the snowfall was above average.
It was followed by a warm spring which caused
flood conditions in many of the nearby rivers.

<Chart year={year} data={global.data} color="#fcb32c" />

Proposed Solution

  • Add frontend tooling like vite
  • Add vite-mdx
  • Support for a data connecter through socket to pass data from python to mdx files as variables
    • globals as common variable to pass data as json
    • from python dictionary it can easily be converted to javascript object
    • which is what is needed in most of the charting library in react

Additional context

JSX and react frontend has lot of charting tools like d3 which are very useful, it would be really helpful to show data from python exports to those frontend renders like mdx

### Tasks

arindampradhan avatar May 18 '24 10:05 arindampradhan

Thank you for opening this enhancement request @arindampradhan! This might be a good enhancement to begin with as an extension and have it move into core if there is overall consensus on doing so.

RRosio avatar May 21 '24 16:05 RRosio