Scrabbly notes on generating OU-XML from Jupyter notebooks. There may well be spin-offs such as a route for producing OU-XML from markdown. (The OU has been using OU-XML for years so there’s surely a Markdown to OU-XML engine somewhere that someone has written, surely?)
With several courses looking at the possibility of using notebooks, having a workflow that supports authoring as well as interactive content delivery using notebooks or a Jupyter markdown / Rmd equivalent could make for a much lighter workflow than the current one.
I think the internal OpenCreate
project has been shelved for now (anyone fancy FOI-ng how much was spent on it?;-) so I’m not sure if there are any bits of code or novel process/workflow that are salvageable or reusable from that, particular insofar as they relate to facilitating more agile workflows?
One of the issues we’ve found on TM351 is that notebook maintenance using Github is possible but can be a bit of a pain when trying to check-in or compare run notebooks. One thing I intend to explore is whether we could just as easily create a workflow around linked Jupytext
documents that would allow us to author in notebooks and check-in dual markdown documents.
Something else to note is the extent to which the notebook .ipynb
JSON format might be useful as a feed for accessibility tools. The cell structure and markdown code should presumably provide an easier to parse source for such tools than the mass of styled HTML that the notebook interface provides? I keep thinking that the Calysto nbplayer
, which plays through a notebook a step at a time on the command line, might be useful as a route towards an accessible notebook player, perhaps with added support from pindent
(code; see also these other random accessibility thoughts)? (By the by, other accessibility features we could explore include automatically generating image descriptions or sonifications from data driven charts.)
In terms of what needs doing on a, Jupyter nbconvert
uses mistune
(docs) to convert markdown to HTML, which looks like it should be easy to subclass, or fork if needs be, to generate a markdown to OU-XML converter. There are also some contributed packages which might provide some handy references…
The Jupyter nbconvert
package also demonstrates how to extend mistune to render maths content. The HTML templates look like they should provide a good basis for a full OU-XML template.
If it helps, as of March 2019, ipynb
is “a thing” within pandoc.
You can find OU-XML in “other formats” section of OpenLearn course area (example):
(It would be nice if OpenLearn posted example XSLTs etc?)
Regarding nbplayer: I have found that my afternoon hack is quite useful as it is, but you are right that it could be useful in other ways and uses, such as accessibility. My plan is to use the prompt-toolkit’s amazing terminal support to really render the markdown cells in a proper manner.
@doug One thing that keeps coming to my mind is how the notebook cell structure should support audio well for partially sighted or blind readers. (That said, I’m not sure how good support is for rendering markdown, cf. HTML, as audio.)
Using things like pindent to additionally comment code could be applied at a cell level, if eg someone found a code cell hard to navigate because of multiple levels of code indentation.
Output cells are also usefully granular, especially if you can generate textual descriptions of them at that level?