<jupyter_start><jupyter_text>Custom Javascript ExtensionThis notebook tests a couple of scenarios on how extension notebooks with javascript. **not complete**<jupyter_code>from jyquickhelper import add_notebook_menu
add_notebook_menu()<jupyter_output><empty_output><jupyter_text>Custom extension<jupyter_code>import os
from notebook.nbextensions import install_nbextension
from jyquickhelper.js.custom import __file__ as loc
path = os.path.dirname(loc)
dest = install_nbextension(path, user=True, destination="jyquickhelper_custom")
dest.split('AppData')[-1]
os.listdir(dest)
%%javascript
Jupyter.utils.load_extensions('jyquickhelper_custom')
%%html

<p class="jyquickhelper">should be red</p><jupyter_output><empty_output><jupyter_text>This does not really works.  Local extension<jupyter_code>from jyquickhelper.js import load_extension
load_extension('renderjson')
%%HTML
<script src='renderjson.js'>
var load_jyq_css_renderjson = function(cssfile) {
    var link = document.createElement("link");
    link.type = "text/css";
    link.rel = "stylesheet";
    link.href = require.toUrl(cssfile);
    document.getElementsByTagName("head")[0].appendChild(link);
};
</script>
%%html
<div id="testrjs"></div>
%%javascript
document.getElementById("testrjs").innerHTML = "<p>Wait..</p>"
%%javascript
document.getElementById("testrjs").appendChild(
    renderjson({ hello: [1,2,3,4], there: { a:1, b:2, c:["hello", null] } })
);<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13764624913971094, 'fraction_numerical': 0.0055058499655884375, 'mean_word_length': 7.920245398773006, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '232636', 'license': 'MIT', 'n_tokens_mistral': 486, 'n_tokens_neox': 480, 'n_words': 92, 'path': '_doc/notebooks/notebook_custom_extension.ipynb', 'repo_name': 'sdpython/jyquickhelper', 'size': '1453'}