You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All changes need to be made in the file section.ipynb or however you renamed your Notebook
Update Quarto
Before starting it is important to update your Quarto version to the latest (July 24) version Quarto 1.5.54. For Codespace this is done by making a new Codespace. Before doing that make sure you have Pushed any changes back to GitHub.
You can make a new Codespace here - you only need to select the repository you want to use all the other settings can remain the same. https://github.com/codespaces
The new query uses a filter that only lets dates in one of the formats through.
2. Images Rendering at the End of Your Book
The reason for the incorrect placement of the images is that Quarto doesn't recognise them as proper image files. The python library used for the image rendering (PIL) allows them to show up in the Jupyter Notebook but leads to errors during conversion to HTML, PDF and EPUB.
2.1. Replace the old get_img-function with this snippet to change the way they are displayed to Markdown:
defget_img(partOfItem_id):
q=""ifpartOfItem_id:
q=query_img.replace("<placeholder>", "?partOfStatement cpsps:P6 cps:"+partOfItem_id+".")
else:
q=query_img.replace("<placeholder>","")
results_img=run_query(endpoint_url, q)
foriteminresults_img["results"]["bindings"]:
title=item['itemLabel']['value']
description=html.unescape(item['itemDescr']['value'])
print('\nWikibase link: '+'['+item['imgItem']['value'] +']'+'('+item['imgItem']['value'] +')'+'\n')
print('Title: '+title+'\n')
print('Year: '+item['publishDate']['value'] +'\n')
print('Description: '+description+'\n')
# get image from image URLimage_url=item['imgUrl']['value']
# display image with title + alt text (in markdown)print('!['+title+']('+image_url+'){fig-alt="'+description+'"}\n\n')
Instead of an image thumbnail you will now see a Markdown expression, similar to this: ![Die barocken Schloss- und Gartenveduten bild](https://previous.bildindex.de/bilder/fmd10005861a.jpg){fig-alt="Bild für Die barocken Schloss- und Gartenveduten"}, in your notebook's output. This is fine, it will still show up as an image in the other formats.
2.2. Remove the now unused imports and functions:
Simply delete these lines at the very start of the file:
How to Fix Your Notebook’s Images
(Combined fix for issues #20 and #13.)
All changes need to be made in the file
section.ipynb
or however you renamed your NotebookUpdate Quarto
Before starting it is important to update your Quarto version to the latest (July 24) version Quarto 1.5.54. For Codespace this is done by making a new Codespace. Before doing that make sure you have Pushed any changes back to GitHub.
You can make a new Codespace here - you only need to select the repository you want to use all the other settings can remain the same. https://github.com/codespaces
To update locally use this https://quarto.org/docs/download/release.html
1. Duplicated Images
The duplicated images are caused by SPARQL: It outputs every result twice in different date formats. To fix that, simply change the query.
Replace the content of your
query_img
with this:The new query uses a filter that only lets dates in one of the formats through.
2. Images Rendering at the End of Your Book
The reason for the incorrect placement of the images is that Quarto doesn't recognise them as proper image files. The python library used for the image rendering (PIL) allows them to show up in the Jupyter Notebook but leads to errors during conversion to HTML, PDF and EPUB.
2.1. Replace the old
get_img
-function with this snippet to change the way they are displayed to Markdown:Instead of an image thumbnail you will now see a Markdown expression, similar to this:
![Die barocken Schloss- und Gartenveduten bild](https://previous.bildindex.de/bilder/fmd10005861a.jpg){fig-alt="Bild für Die barocken Schloss- und Gartenveduten"}
, in your notebook's output. This is fine, it will still show up as an image in the other formats.2.2. Remove the now unused imports and functions:
Simply delete these lines at the very start of the file:
and also delete these two functions which we don't need anymore if we aren't using PIL:
3. Update Your Repository
section.ipynb
.quarto render
and thenquarto preview
.The text was updated successfully, but these errors were encountered: