✨ Add text/markdown MIME renderer#102
Conversation
|
@rowanc1 deleting the yarn lockfile leads to the build failing. I can't figure out exactly what the error is, hoping you'll know. |
rowanc1
left a comment
There was a problem hiding this comment.
Adding a few thoughts as I look through this!
| this.resolver = options.resolver; | ||
| this.linkHandler = options.linkHandler; | ||
| this.node.dataset['mimeType'] = MIME_TYPE; | ||
| this.addClass('myst-RenderedMySTMarkdown'); |
There was a problem hiding this comment.
There is some css that requires this to be wrapped in a top-level myst, we can change the name of that, but it will need it to be the same as the cell, or added in.
| const { frontmatter: frontmatterRaw } = getFrontmatter( | ||
| // This is a bit weird, but if there is a YAML block in the first cell, this is where it will be. | ||
| mdast, | ||
| { | ||
| removeYaml: true, | ||
| removeHeading: true | ||
| } | ||
| ); |
There was a problem hiding this comment.
My understanding is that this is for inline markdown? I think that we shouldn't parse the frontmatter unless it is specifically the first cell of a notebook.
| > | ||
| <TabStateProvider> | ||
| <ReferencesProvider | ||
| references={references} |
There was a problem hiding this comment.
Is this intended to share the state with other cells, e.g. can you reference an equation in the notebook with this?
It that is the case, then this needs to be the shared references, which gets a bit tricky (maybe?)
There was a problem hiding this comment.
Yes it does! When I wrote this PR initially, I just wanted to get the majority of the boilerplate on the page. The semantics are probably in need of some work :)
text/markdown MIME renderer
|
@rowanc1 this now builds, and renders, but it's a bit broken:
I just wired everything together (I have no high-level understanding of the details of the AST transform/rendering), so I'm not surprised. Are you happy to take over this PR when you're next free (no rush)? |
0ce22a0 to
8bff032
Compare
Addresses error with nth-check source-map parsing: webpack-contrib/source-map-loader#186
| this.resolver = options.resolver; | ||
| this.linkHandler = options.linkHandler; | ||
| this.node.dataset['mimeType'] = MIME_TYPE; | ||
| this.addClass('jp-RenderedMySTMarkdown'); |
There was a problem hiding this comment.
should this be jp-MarkdownOutput? or both?
There was a problem hiding this comment.
I'm avoiding using the Jupyter tags, as they bring their own assumptions that might not reflect ours. We don't use the jp tags elsewhere, but if we need to, we can! For now, assuming not.
There was a problem hiding this comment.
ok, I was comparing with the CSS classes used on the notebook side (that make styles and scrolling work) -- I haven't tried your latest changes yet
There was a problem hiding this comment.
Ah, I see! I've fixed the scrolling (setting overflow rules, although it's currently a private variable - we should use our own), and the styles look correct to me, now.
text/markdown MIME renderertext/markdown MIME renderer
@agoose77 I just came across this old remark of yours -- I think the answer is indeed pinning the |
We want to support all versions of JupyterLab greater than our lower bound. Therefore, I think we don't even want to pin these deps during development, as it means we'll catch these kinds of failures before someone installs the package in whichever JupyterLab is misbehaving. Although we could probably go lower than 3.4.7, that's the minimum version that our PyPI package supports, so it's already "in the wild". If there are build failures with a specific version of JupyterLab, we should fix those directly. When the extension is installed in JupyterLab, it will provide its own versions of these packages, after all! |
True. Should the yarn lockfile be removed from git and gitignored? Otherwise it somehow still seems wrong to me to have all these Edit 1: Ah looks like you fixed that (except for markdownviewer). Edit 2:
@agoose77 I like that philosophy but I think it won't happen unless the yarn lockfile is actually removed from version control? |
Yes, for the most part this is true. In general, my aversion to resolutions is that they're used to fix broken As such, unless @rowanc1 has any reservations, I'd prefer to continue working with a central lockfile that we'll keep up to date, and we'll open bug reports if something breaks within our constraints. |
So upgrading most/all of the libraries in the yarn lockfile was the intention (I now see this has been done on the main branch)? Sorry I did not realize that's what you wanted, it's a different approach than what I had in mind (i.e. keeping them locked to the lower bound). Thanks for the background! |
No need to apologise for a good discussion. I'm not a JS developer by trade, so take this with a pinch of salt. My contention is that the actual locked versions don't matter, as long as they work. What matters is our So, I'm viewing the lockfile as "ensure everyone's working with the same dependencies", which is not entirely useful as we're developing a library/plugin rather than a standalone application, but is the typical workflow. |
|
@agoose77 My concern was basically being unable to build the project without a magic lockfile :) |
|
To be clear on my position here —
should never fail either; it should be that whatever lockfile you have, the build succeeds. If that fails, we don't support what we say we support, and should fix it! In any case, let's see how things go :) |
|
Just a quick note to apologize for my lack of attention over in this repo! @tavin it has been great working with you over in the theme, and exciting to see that the work can come over here easily with proofs and all the style updates. I am on vacation the next week and a bit, so hopefully won't be checking GitHub that much. Hoping when I get back to give this repo a bit more of my time! |
|
In the interest of getting JupyterLab 4.x working, I'm going to merge this. It appears to work! |
|
Excited to try this! |
Fixes #100 by overwriting the default
text/markdownMIME renderer with a MyST enabled renderer.