Skip to content

Conversation

@vhquang
Copy link

@vhquang vhquang commented Jan 16, 2018

This is done through 2 main steps:

  • Adding new extension "ipynb" as external handler. This also requires
    jupyter and its converter, but can gracefully fall back to raw content.
  • Add an alternative parser, only for .ipynb type, because .ipynb file
    is one whole JSON object. That will have different proccessing than parsing
    JSON frontmatter.

The frontmatter for .ipynb is expected in the "metadata" of the notebook:

{
  "metadat":{
    "frontmatter": {
      "title": ""
    }
  }
}
This is done through 2 main steps:
- Adding new extension "ipynb" as external handler. This also requires
`jupyter` and its converter, but can gracefully fall back to raw content.
- Add an alternative parser, only for .ipynb type, because .ipynb file
is one whole JSON object. That will have different proccessing than parsing
JSON frontmatter.

The frontmatter for .ipynb is expected in the "metadata" of the notebook:
```
{
  "metadat":{
    "frontmatter": {
      "title": ""
    }
  }
}
```
@vhquang
Copy link
Author

vhquang commented Jan 16, 2018

At the moment, I think placing the frontmatter into the metadata of the notebook makes the most sense. Another alternative, is to place it in the root of the JSON, but this will likely require a plugin for jupyter.

{
    "cells": [],
    "frontmatter": {},
    "metadata": {}
}

I am happy to get any feedback. And if anyone knows the best place in the document to write this in, I will gladly update the docs as well.

@bep
Copy link
Member

bep commented Jan 16, 2018

Thanks for this. The code looks good, but as I have no idea what ipynb is, I don't know whether this is worth adding to Hugo.

I suggest you create a thread at https://discourse.gohugo.io/ to discuss the use case before creating any more code.

@bep bep closed this Jan 16, 2018
@vhquang
Copy link
Author

vhquang commented Jan 20, 2018

Thanks for the feedback on my PR. I also notice the fact that this PR proposes a whole different flow of processing content file. Taking the discussion to discourse to collection more opinion is a good idea.

@vhquang
Copy link
Author

vhquang commented Feb 3, 2018

Hi @bep , I use an old thread to discuss about the change I propose in this PR:
https://discourse.gohugo.io/t/ipython-notebook-support/3211/3

I am eager to implement the change that we are discussing. Would you like to join us and give us some feedback?

@henryiii
Copy link

henryiii commented Nov 8, 2018

@bep

but as I have no idea what ipynb is

It's a jupyter notebook file. You can mix computations and markdown, and the outputs are saved in the file. See, for example, this article in Nature, which notes that GitHub has more than 2.5 million ipynb files. GitHub, GitLab, Nickola, Indico, and others all support rendering this file format. Not sure if this PR is the right way to do it, but it would be a great way to write blog posts for anyone in the sciences!

@petr-tik
Copy link

petr-tik commented Sep 9, 2019

@bep

Thanks for creating this awesome one-stop-shop to easily write, generate and publish static websites - I enjoy using it for my website.

I am writing to ask you to add ipynb as a first class citizen to hugo. I would be happy to resume work on this branch and settle merge conflicts, where necessary.

I would like to use it and I think having native support will solidify hugo's popularity for people, who primarily work in notebooks.

Jupyter is the literate programming paradigm for the scientific community, which is increasingly growing in popularity in academia, machine learning, data science and data exploration.

There are several plugins written by keen users of jupyter and Hugo, so we are not the only people keen on this feature:
https://www.vincent-lunot.com/post/toward-publishing-jupyter-notebooks-with-hugo/
https://github.com/knowsuchagency/hugo_jupyter
https://pypi.org/project/nbhugoexporter/

I am a user of org-mode and I think that since Hugo supports org-mode, it only makes sense to support jupyter as well.

@rafed
Copy link

rafed commented Nov 8, 2020

What's the update on this? It would be really cool if this was added.

@ryan4yin
Copy link

ryan4yin commented Feb 24, 2021

any update on this? I like this feature because I have many notes written in .jpynb

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2022
@vhquang vhquang deleted the support-rendering-ipynb branch February 26, 2022 06:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

6 participants