Open johnjbarton opened 1 year ago
Looks like the fail is here:
html = marked(ul['text/plain']);
in python-markdown/main.js.
The object ul['text/plain']
is the python value to be displayed.
So the 'marked is not a function' error is symptom, not a cause. The entry in ul
has not been converted to something that markdown can handle.
This is due to changes in the notebook main code itself. The "marked" library is no longer included there. It can be fixed, but it is a little bit tricky. In case you want to try:
marked.js
file from https://cdnjs.com/libraries/marked and copy it to the python-markdown
extension directory'components/marked/lib/marked',
with nbextensions/python-markdown/marked.min',
marked(...)
by marked.marked(...)
calls in main.js
of the extension.Thanks. Do you have any posts on the nbextensions transition?
I have to say that the choice between no extensions (all disabled by default) and extensions that just fail makes the platform very unattractive. I would have expected a "stable" distribution with old extensions and a "beta" distribution for transitions.
On Sun, May 7, 2023 at 1:05 PM Juergen Hasch @.***> wrote:
This is due to changes in the notebook main code itself. The "marked" library is no longer included there. It can be fixed, but it is a little bit tricky. In case you want to try:
- Download the marked.js file from https://cdnjs.com/libraries/marked and copy it to the python-markdown extension directory
- Replace 'components/marked/lib/marked',with nbextensions/python-markdown/marked.min',
- Replace all calls to marked(...) by marked.marked(...) calls in main.js of the extension.
— Reply to this email directly, view it on GitHub https://github.com/ipython-contrib/jupyter_contrib_nbextensions/issues/1638#issuecomment-1537529703, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABSGATYIWR25LZNZFSBVBDXE76BLANCNFSM6AAAAAAXYPZHOY . You are receiving this because you authored the thread.Message ID: <ipython-contrib/jupyter_contrib_nbextensions/issues/1638/1537529703@ github.com>
Ok I cloned the repo and edited per your instructions.
I used https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/master/CONTRIBUTING.md#setup-development
but when I run jupyter notebook
I still get the original main.js, rather than my modified one.
Where might I ask about dev setup issues?
Is committing marked.min to python-markdown/ in the plan for v6+?
Maybe the two different marked libs could both be required and have a runtime test/fallback?
I accidently noticed that on the nbextensions_configurator tab there was an info panel: "This nbextension's require url (python-markdown/main) is referenced by two different yaml files on the server." The server log confirms that this duplicate issue.
I don't recognize either path however, eg [W 17:18:10.571 NotebookApp] [jupyter_nbextensions_configurator] nbextension 'python-markdown/main' has duplicate listings in both 'C:\Users\jjb\AppData\Local\Programs\Python\Python311\share\jupyter\nbextensions\python-markdown\python-markdown.yaml' and 'C:\Users\jjb\AppData\Roaming\jupyter\nbextensions\python-markdown\python-markdown.yaml'
There must be some server config that points now to two roots for nbextensions.
Using this hint
I ran
jupyter contrib nbextensions uninstall --user
and the duplicates are gone and the Python variable interpolation works.
Unfortunately I succeeded by dumb luck. I made more edits and these do not appear in the app. I tried various uninstall/install commands but no dice.
It seems as if the app runs off stuff in AppData rather than my git repo directly. Some command must copy files into the AppData.
The command
jupyter contrib nbextension install --user
did the trick. IDK why.
Any update on this? I am having the same issues outputting just the example'a = 1.23' '{{a}}' in the extensions documentation.
@bradenmitchell I don't know if it is useful, but I can confirm that @johnjbarton's patches work, at least for me. You should be able to use them, instead of the default Jupyter notebook extensions, by running:
pip install 'git+https://github.com/johnjbarton/jupyter_contrib_nbextensions.git@84aeb3b0c9880d47c562d80d5155fb87caaecac2'
(Probably best to do so in a venv.)
I've also got a small docker-compose example demonstrating them - details below.
@juhasch or other maintainers - are the patches suggested by johnjbarton likely to be incorporated into the repo, thus fixing this bug?
(New user here) python-markdown seems like a killer feature... but rendering python silently fails for me.
I assume this is some config/install issue. I've not found any debug procedure or hints.
In the browser debugger I see 'TypeError: marked is not a function '. That seems bad ;-)
markdown does render otherwise, just the variable interpolation fails. The double braces and the var are missing:
Davidson Gemer electron velocity {{ dg_electron_velocity }} kg/sec and wavelength {{ dg_wavelength }}
becomes
Davidson Gemer electron velocity kg/sec and wavelength