-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting the title from jupyter notebooks (ipynb) #5905
Comments
Getting the title from metadata cannot work for now because of jgm/pandoc#5905.
Is there a standard way of representing the title in a notebook? |
tbh, I don't think so. But reading out the notebook metadata would make sense (it's the equivalent of a The Maybe @mwouts can tell us more about this? |
The I'd tend to add |
I'm currently working around this with the following Lua filter: function Meta(m)
if m.jupyter.meta then
for k,v in pairs(m.jupyter.meta) do
m[k] = v
m.jupyter.meta[k] = nil
end
m.jupyter.meta = nil
end
return m
end This will extract fields from under a So, for example, if you save this to a file called pandoc --lua-filter=pandoc_ipynb_meta.lua ... on a notebook with the following metadata; {
"meta": {
"title": "This is a title",
},
"kernelspec": {
"language": "python"
}
} you will get a markdown file with the following header: title: This is a title
jupyter:
kernelspec:
language: python |
Hi @claudioperez , to follow up on @grst 's earlier comment, in Jupytext we either
So 2. is similar to your approach, except that we store the title, etc at The corresponding test is here (for a R Markdown file, but it works the same for a md file): |
I suggest changing the title of this issue to something like "ipynb metadata support", as this is general to any metadata, not only the title. I think the ipynb-way is to just dump it as JSON in |
FYI, I just wrote a filter where one of the thing it does is to convert the jupytext metadata block to native pandoc metadata block: https://ickc.github.io/pannb/api/pannb/#pannb.walk_and_convert_jupytext_metadata Although I think using the JSON |
When I convert a
ipynb
file tohtml
, I don't manage to get pandoc to find the title:I tried
1) specifying the title in
yaml
format in araw
cell (jupytext style, see #5398).yaml_title.ipynb
2) specifying the title in the notebook-metadata:
metadata_title.ipynb
running on plain markdown file works fine
yaml_title_md.md
Pandoc was run with
--self-contained
:No html title is found for the jupyter notebooks
(the filename is used instead)
Availability:
Full example repo: https://github.com/grst/test_pandoc_title
Pandoc version
tested on the latest release and built from source as of
2019-11-13
.The text was updated successfully, but these errors were encountered: