mknotebooks icon indicating copy to clipboard operation
mknotebooks copied to clipboard

Support YAML front-matter metadata

Open rclement opened this issue 2 years ago • 3 comments

When using MkDocs, we have the possibility of putting extra article metadata in a YAML front-matter at the top of the Markdown document. This allows for custom formatting, such as selecting the template to use, etc.

When trying the same thing with a Jupyter Notebook, the top YAML front-matter is rendered as any Markdown cell and not picked up by MkDocs as such.

Here is a scenario in action:

I try digging nbconvert documentation but could not find anything relevant nor enabling a workaround. The only thing that seems to be working is using the MarkdownExporter but mknotebooks uses the HTMLExporter.

Any ideas?

rclement avatar Sep 26 '21 08:09 rclement

A quick follow-up. In the following issue referring to adding a blog feature in mkdocs-material, @timvink mentioned mknotebooks being up for the task: https://github.com/squidfunk/mkdocs-material/issues/3353#issuecomment-998516787

As stated in this issue, mknotebooks does not support YAML front-matter metadata in the first notebook cell.

@greenape is there any reason mknotebooks uses internally the "HTMLExporter" instead of the "MarkdownExporter" from nbconvert?

rclement avatar Dec 29 '21 13:12 rclement

+1. If we're going to get blog support improved in mkdocs, this feature would make sense!

@greenape would you be interested in investigating this and picking this up? If not, do you agree on the direction and would you be open to contributors?

timvink avatar Dec 29 '21 20:12 timvink

Contributions are very welcome! (I don't have a lot of time to work on this at the moment.)

Did originally use the markdown exporter for this, but at the time it was rather less capable than the html one especially when dealing with widgets etc. (May no longer be the case, I haven't checked)

greenape avatar Dec 29 '21 21:12 greenape