Skip to content

Instantly share code, notes, and snippets.

@pcornier
Last active January 29, 2019 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcornier/93290fa3c053ddb87cf63807186d5eef to your computer and use it in GitHub Desktop.
Save pcornier/93290fa3c053ddb87cf63807186d5eef to your computer and use it in GitHub Desktop.
Jupyter + nbwavedrom, JS error
# MyHDL + MyHDLPeek + NBWaveDrom
# replace the last <script> tag with a <style onload="">
# vim $PREFIX/lib/python3.7/site-packages/nbwavedrom/__init__.py
def _draw_wavedrom_javascript(data, width):
style = ""
if width != None:
style = ' style="width: ' + str(int(width)) + 'px'
htmldata = '<script>' + open(_get_js_path('wavedromskin.js')).read() + '</script>'
htmldata += '<script>' + open(_get_js_path('wavedrom.min.js')).read() + '</script>'
htmldata += '<div' + style + '><script type="WaveDrom">' + data + '</script></div>'
htmldata += '<style onload="WaveDrom.ProcessAll()"></style>'
return IPython.display.HTML(data=htmldata)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment