{ "info": { "author": "Jason Bandlow", "author_email": "jbandlow@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Export Notebooks To Hugo Compatible Markdown\n\n## Basic Installation and Use\n```\npip install nbhugoexporter\n```\nwill install the exporter. You will also need to add some shortcode definitions\nto Hugo. You can customize these as you wish, but an easy way to get started is\nto run the following from the root of your Hugo project:\n```\nmkdir -p layouts/shortcodes\nfor x in cell input; do for y in start end;\n do curl -L https://github.com/jbandlow/nb_hugo_exporter/raw/master/resources/jupyter_$x\\_$y.html > layouts/shortcodes/jupyter_$x\\_$y.html;\ndone; done;\n```\n\nYou can then run the exporter with\n```\npython3 -m nbconvert path/to/nb_file.ipynb --to hugo --output-dir content/path/insert-title-here\n```\nThis will create a `content/path/insert-title-here` directory with an\n`index.md` file derived from `nb_file.ipynb`. The generated metadata will include\n```\n---\ntitle: Nb File\ndate: \ndraft: True\n...\n---\n```\nalong with any other metadata you've specified. To set metadata, go to Edit ->\nEdit Notebook Metadata from within your notebook, and add\n```\n\"hugo\": {\n \"key1\": value1,\n ...\n}\n```\nwith whatever keys and values you wish. The `title` value will default to the\nnotebook filename with snake\\_case replaced by Initial Caps. All auto-generated\nvalues (`title`, `date`, and `draft`) can be overridden in the notebook\nmetadata.\n\nThe resulting markdown will contain the following hugo shortcodes:\n```\n{{% jupyter_cell_start [cell_type] }}\n{{% jupyter_input_start }}\n...\n{{% jupyter_input_end }}\n...\n{{% jupyter_cell_end }}\n```\nin the places you'd expect. `[cell_type]` is the Jupyter cell type, e.g.,\n`markdown`, `code`, etc. Code itself will have GitHub style code fences:\n\n````\n```python\nimport this\n```\n````\n\nSet `pygmentsCodeFences` to `true` in your Hugo configuration file to use a\nsyntax highlighter. See the [hugo\ndocumentation](https://gohugo.io/content-management/syntax-highlighting/) for\nmuch more on this.\n\nYou may also want to enable the `noEmptyLineBeforeBlock` [BlackFriday\nextension](https://gohugo.io/content-management/formats/#blackfriday-extensions).\nMarkdown in Jupyter is processed as though this setting were enabled.\n\n\n## CSS configuration\n\nYou may also want to configure your CSS. The main design goal for this project\nwas to generate markdown that could be styled to my particular tastes. The\nshortcodes are simply used to generate `div`s, and the corresponding classes are\nthen easy to style. With the shortcodes in this repo, the resulting HTML\nlooks like:\n\n```\n
\n
...
\n ...\n
\n```\n\nIn concert with styling the syntax highlighter, this can be\nmade to look more or less like Jupyter's own theme, or like anything else you\nwish. Note that the exporter currently adds some unnecessary blank lines. These\ncan be cleaned up with\n\n```\n.jupyter-cell p:empty { display: none; }\n```\n\n## Latex\n\nFinally, for LaTeX to render properly, you should [include the MathJax script](\nhttps://gohugo.io/content-management/formats/#enable-mathjax) on your pages.\nNote that `nbconvert --to hugo` solves the [underscore problem](\nhttps://gohugo.io/content-management/formats/#issues-with-markdown) with the\n\"tedious\" solution of simply quoting all underscores in math mode. So there is\nno need for the MathJax configuration script that \"fixes \\ tags\" in your\nJavascript, or the custom CSS described in that post.\n\nThat's it! Happy blogging with Jupyter notebooks and Hugo.\n\n## Acknowledgements\nShout-out to the amazing [Hugo](https://gohugo.io), and\n[Jupyter](https://jupyter.org) teams for building incredible tools.\n\nFor another approach to this issue, see\n[hugo-jupyter](http://journalpanic.com/hugo_jupyter/), from [Stephan\nFitzpatrick](https://github.com/knowsuchagency). This didn't fully fit my needs,\nbut it might fit yours.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jbandlow/nb_hugo_exporter", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "nbhugoexporter", "package_url": "https://pypi.org/project/nbhugoexporter/", "platform": "", "project_url": "https://pypi.org/project/nbhugoexporter/", "project_urls": { "Homepage": "https://github.com/jbandlow/nb_hugo_exporter" }, "release_url": "https://pypi.org/project/nbhugoexporter/0.2.0/", "requires_dist": [ "nbconvert", "traitlets" ], "requires_python": "", "summary": "Export Jupyter notebooks to a Hugo compatible format", "version": "0.2.0" }, "last_serial": 4151159, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "640921e97ded8a3902dc7611a9655921", "sha256": "dbb974ac56c0475547573f3ddd65888e1fb0ca69d1884848b06f9137ace5d7fa" }, "downloads": -1, "filename": "nbhugoexporter-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "640921e97ded8a3902dc7611a9655921", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8169, "upload_time": "2018-07-10T17:11:23", "url": "https://files.pythonhosted.org/packages/1b/fd/0c287ac26402eb74f7558dc318a607593e0e9c1cfd52932f9b2ea11b84a5/nbhugoexporter-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2807a87f5bbb0db6882f4dd1d7c02e19", "sha256": "1336e74967d6508a9331e29c96658d93c194824e2d6d47563a0b8e62868072f7" }, "downloads": -1, "filename": "nbhugoexporter-0.1.1.tar.gz", "has_sig": false, "md5_digest": "2807a87f5bbb0db6882f4dd1d7c02e19", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5681, "upload_time": "2018-07-10T17:11:24", "url": "https://files.pythonhosted.org/packages/11/83/b4b195c2501ee09d9aa75eebc4358fba89d46c190245923db4af8226ce5b/nbhugoexporter-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "22444d46c4bbbafc7aa4045329135abb", "sha256": "d70f0ece173987a26a2cbebc8c3426e83e72698ac1ebb66e45015e104e76dfa5" }, "downloads": -1, "filename": "nbhugoexporter-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "22444d46c4bbbafc7aa4045329135abb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8620, "upload_time": "2018-07-10T17:29:47", "url": "https://files.pythonhosted.org/packages/9f/ae/1ec8f74176f7f7b98b1e89e8c906edaa3d63c9a34293add52c6aaea52271/nbhugoexporter-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1b0e0e6f196c40bc1584ea42450b0493", "sha256": "eadab26582b15427fa8d81d39c0412acac031337d51f804f341912241a98fe27" }, "downloads": -1, "filename": "nbhugoexporter-0.1.2.tar.gz", "has_sig": false, "md5_digest": "1b0e0e6f196c40bc1584ea42450b0493", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5911, "upload_time": "2018-07-10T17:29:48", "url": "https://files.pythonhosted.org/packages/6c/54/885079b40ad6785de36de451315e83e0c6383551821ed1e295f2a5f4c420/nbhugoexporter-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "c2f593390d5560103b76a104a3395dec", "sha256": "576387b6b88b7d40d6270932d2cbbf44d533ac4e830c31d0d29b8e0d856a6edb" }, "downloads": -1, "filename": "nbhugoexporter-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "c2f593390d5560103b76a104a3395dec", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8639, "upload_time": "2018-07-10T17:48:16", "url": "https://files.pythonhosted.org/packages/8c/f1/dd6ddf6f5b07170ad2b474974229044e2ce268c2eec3a205195fb37eaa1d/nbhugoexporter-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "082da56abda6022555f96e05996a66ea", "sha256": "c367063fdb736f604c97b8558a1cec2ebe6140daa95ef8b7527261ceee206632" }, "downloads": -1, "filename": "nbhugoexporter-0.1.3.tar.gz", "has_sig": false, "md5_digest": "082da56abda6022555f96e05996a66ea", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5920, "upload_time": "2018-07-10T17:48:17", "url": "https://files.pythonhosted.org/packages/ea/95/9bafd6dc6bcfdb1f24345aa7d397c12a81475a3ebdd3aadcf37138f9d386/nbhugoexporter-0.1.3.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "fb08d96b719870857eb15a1316b4d34e", "sha256": "676131854e7401265076d18f214580506a15c9fbbd53a411a5aab4561590f9bf" }, "downloads": -1, "filename": "nbhugoexporter-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "fb08d96b719870857eb15a1316b4d34e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9566, "upload_time": "2018-08-09T01:12:50", "url": "https://files.pythonhosted.org/packages/f6/5b/5f76bda1e5f58af329a1686ef5ba99463c2b4edf8ae2f23c679a911094a9/nbhugoexporter-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a96c41a33c8f18f3477ed21c66e0e9a5", "sha256": "4a7f465ff19c0735a099542f00812c04f1c806348c611159177c41f0edd408b4" }, "downloads": -1, "filename": "nbhugoexporter-0.2.0.tar.gz", "has_sig": false, "md5_digest": "a96c41a33c8f18f3477ed21c66e0e9a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6487, "upload_time": "2018-08-09T01:12:53", "url": "https://files.pythonhosted.org/packages/52/91/023e577bb23a59ff054a76f2afe5fda066638bc382857ed26a4e20d71657/nbhugoexporter-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fb08d96b719870857eb15a1316b4d34e", "sha256": "676131854e7401265076d18f214580506a15c9fbbd53a411a5aab4561590f9bf" }, "downloads": -1, "filename": "nbhugoexporter-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "fb08d96b719870857eb15a1316b4d34e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9566, "upload_time": "2018-08-09T01:12:50", "url": "https://files.pythonhosted.org/packages/f6/5b/5f76bda1e5f58af329a1686ef5ba99463c2b4edf8ae2f23c679a911094a9/nbhugoexporter-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a96c41a33c8f18f3477ed21c66e0e9a5", "sha256": "4a7f465ff19c0735a099542f00812c04f1c806348c611159177c41f0edd408b4" }, "downloads": -1, "filename": "nbhugoexporter-0.2.0.tar.gz", "has_sig": false, "md5_digest": "a96c41a33c8f18f3477ed21c66e0e9a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6487, "upload_time": "2018-08-09T01:12:53", "url": "https://files.pythonhosted.org/packages/52/91/023e577bb23a59ff054a76f2afe5fda066638bc382857ed26a4e20d71657/nbhugoexporter-0.2.0.tar.gz" } ] }