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
However, all boxes provided by quarto are not supported
Boxes are not as aesthetic as those provided by quarto (or jupyterbook). This is of course not a priority (functional boxes would first be great) but this would be cool to a nice box in notebook. I saw that it is possible to embed some styling element directly in the div (see this stackoverflow thread) but maybe there's a better way to start
@choldgraf maybe has an opinion on the best way to proceed
Once again, I understand that tweaking some notebook features is not a priority. But helping python users generate nice notebooks from quarto could be appreciated
Reacted by Diego Mesa, Torsten C., Royi and Janis Klaise
Yes, we should definitely be able to get this to work! We have some other work on ipynb output we'd like to do soon and will take care of this at that time.
Reacted by Lino Galiana, Luis Gonzalez and Diego Mesa
Also, I think it would be a good feature to add support for a title property in a fallout vox to avoid using headers. Right now, headers inside calloutboxes serve as title for the box, but “hijack” a table of contents/breadcrumbs unnecessarily.
should this be a separate feature request? Thank you!
If it can be of any help, currently I am doing, for instance, this hack:
::: {.cell .markdown}
```{=html}<div class="alert alert-info" role="alert"><h3 class="alert-heading"><i class="fa-solid fa-comment"></i> Note</h3>```
Dans un processus de production, où normalement on connait les types des variables du `DataFrame` qu'on va importer,
il convient de préciser les types avec lesquels on souhaite importer les données
(argument `dtype`, sous la forme d'un dictionnaire).
Cela est particulièrement important lorsqu'on désire utiliser une colonne
comme une variable textuelle mais qu'elle comporte des attributs proches d'un nombre
qui vont inciter `pandas` à l'importer sous forme de variable numérique.
Par exemple, une colonne `[00001,00002,...] ` risque d'être importée comme une variable numérique, ignorant l'information des premiers 0 (qui peuvent pourtant la distinguer de la séquence 1, 2, etc.). Pour s'assurer que `pandas` importe sous forme textuelle la variable, on peut utiliser `dtype = {"code": "str"}`
Sinon, on peut importer le csv, et modifier les types avec `astype()`.
Avec `astype`, on peut gérer les erreurs de conversion avec le paramètre `errors`.
```{=html}</div>```
:::
An example can be found here. More generally I have built different boxes based on alert divs in Jupyter and I can share more if it helps, for instance the associated CSS.
This is what looks like the box on my jupterlab instance, after rendering the file using ipynb format :
There is still some work to get ir nicely rendered on google colab, there are probably some parameters that override my hacks
I managed to do something, not perfect but functional using lua. I used it for a few months and forgot to share it here.
My solution
Basically, my solution has been to create special divs to handle boxes: my lua script recognizes them and
for ipynb output, it replaces with appropriate html code (proposition below)
for other format, it replaces with the appropriate callout call that should be used when using quarto
In other words, in my quarto input document (.qmd), to create a note callout I would do
::: {.note}
## Note title
Note content
:::
instead of
::: {.callout-note}
## Note title
Note content
:::
This special div is not perfect, it is a workaround, that I would be happy to avoid if Quarto integrates a solution for callout-* in ipynb format.
My lua script injects the appropriate html tags around the content of the box. Ideally, I would use classes like callout callout-style-default callout-note etc. but I noticed that these classes do not render well on my JupyterLab instance (cloud version with quarto extension installed). So I had to go for bootstrap alert classes that render better on jupyterlab.
:::: {.tip}
## Skills to be acquired by the end of this chapter- Import a dataset as a `Pandas` dataframe and explore its structure;
- Perform manipulations on columns and rows;
- Construct aggregate statistics and chain operations;
- Use `Pandas` graphical methods to quickly represent data distribution.
::::
will become like that in the final output (when doing quarto render toto.qmd --to ipynb) when using the filter
<div class="alert alert-success" role="alert">
<h3 class="alert-heading"><i class="fa-solid fa-lightbulb"></i> Skills to be acquired by the end of this chapter</h3>
- Import a dataset as a `Pandas` dataframe and explore its structure;
- Perform manipulations on columns and rows;
- Construct aggregate statistics and chain operations;
- Use `Pandas` graphical methods to quickly represent data distribution.
</div>
You can see an example of rendering in Github UI here.
In VSCode (server version with quarto extension enabled) it looks like
In JupyterLab (server version with quarto extension enabled) it looks like
This does the job, except on colab that looks like supercharging jupyterlab with css that makes alert box non visible.
How it could be even better
But I'm a maniac. I would like to have nice callouts as would be in html output. I managed to do that with callout classes but only in VSCode (I don't know if it comes from quarto extension or a natural support of that class in vscode). My problem is that does not render well in Jupyter, which makes me terribly sad. Still I share that here if you are interested in that solution:
My script to get nice callout in vscode is here. This time, I could inject the callout classes
(you can see the difference between an alert box (the first one) and a callout in this image (the second one))
unfortunately in jupyter this gives
By the way you can see an example of rendering in Github UI here. It does not render well but I think it does not matter: we want the notebook to be beautiful in our IDE, not in jupyter
Activity
jjallaire commentedon Jun 17, 2022
Yes, we should definitely be able to get this to work! We have some other work on ipynb output we'd like to do soon and will take care of this at that time.
diego898 commentedon Mar 1, 2023
I think this would be great - right now authoring in jupyter notebooks leaves
visible everywhere in the notebook.
diego898 commentedon Mar 4, 2023
Also, I think it would be a good feature to add support for a title property in a fallout vox to avoid using headers. Right now, headers inside calloutboxes serve as title for the box, but “hijack” a table of contents/breadcrumbs unnecessarily.
should this be a separate feature request? Thank you!
jjallaire commentedon Mar 5, 2023
Just added support for
titlehere: 525cb56Should be available in an updated pre-release build later on today.
linogaliana commentedon Jul 17, 2023
If it can be of any help, currently I am doing, for instance, this hack:
::: {.cell .markdown} ```{=html} <div class="alert alert-info" role="alert"> <h3 class="alert-heading"><i class="fa-solid fa-comment"></i> Note</h3> ``` Dans un processus de production, où normalement on connait les types des variables du `DataFrame` qu'on va importer, il convient de préciser les types avec lesquels on souhaite importer les données (argument `dtype`, sous la forme d'un dictionnaire). Cela est particulièrement important lorsqu'on désire utiliser une colonne comme une variable textuelle mais qu'elle comporte des attributs proches d'un nombre qui vont inciter `pandas` à l'importer sous forme de variable numérique. Par exemple, une colonne `[00001,00002,...] ` risque d'être importée comme une variable numérique, ignorant l'information des premiers 0 (qui peuvent pourtant la distinguer de la séquence 1, 2, etc.). Pour s'assurer que `pandas` importe sous forme textuelle la variable, on peut utiliser `dtype = {"code": "str"}` Sinon, on peut importer le csv, et modifier les types avec `astype()`. Avec `astype`, on peut gérer les erreurs de conversion avec le paramètre `errors`. ```{=html} </div> ``` :::An example can be found here. More generally I have built different boxes based on
alertdivs in Jupyter and I can share more if it helps, for instance the associated CSS.This is what looks like the box on my jupterlab instance, after rendering the file using ipynb format :
There is still some work to get ir nicely rendered on google colab, there are probably some parameters that override my hacks
linogaliana commentedon Sep 26, 2024
I managed to do something, not perfect but functional using lua. I used it for a few months and forgot to share it here.
My solution
Basically, my solution has been to create special divs to handle boxes: my lua script recognizes them and
In other words, in my quarto input document (.qmd), to create a note callout I would do
instead of
This special div is not perfect, it is a workaround, that I would be happy to avoid if Quarto integrates a solution for callout-* in ipynb format.
My lua script injects the appropriate html tags around the content of the box. Ideally, I would use classes like
callout callout-style-default callout-noteetc. but I noticed that these classes do not render well on my JupyterLab instance (cloud version with quarto extension installed). So I had to go for bootstrap alert classes that render better on jupyterlab.My lua filter
The most important pieces are this one:
that creates a mapping between callout names and alert classes and that one:
What it looks like
As an example, this text
:::: {.tip} ## Skills to be acquired by the end of this chapter - Import a dataset as a `Pandas` dataframe and explore its structure; - Perform manipulations on columns and rows; - Construct aggregate statistics and chain operations; - Use `Pandas` graphical methods to quickly represent data distribution. ::::will become like that in the final output (when doing
quarto render toto.qmd --to ipynb) when using the filterYou can see an example of rendering in Github UI here.
In VSCode (server version with quarto extension enabled) it looks like
In JupyterLab (server version with quarto extension enabled) it looks like
This does the job, except on colab that looks like supercharging jupyterlab with css that makes alert box non visible.
How it could be even better
But I'm a maniac. I would like to have nice callouts as would be in html output. I managed to do that with callout classes but only in VSCode (I don't know if it comes from quarto extension or a natural support of that class in vscode). My problem is that does not render well in Jupyter, which makes me terribly sad. Still I share that here if you are interested in that solution:
My script to get nice callout in vscode is here. This time, I could inject the callout classes
In vscode, this renders like that:
(you can see the difference between an alert box (the first one) and a callout in this image (the second one))
unfortunately in jupyter this gives
By the way you can see an example of rendering in Github UI here. It does not render well but I think it does not matter: we want the notebook to be beautiful in our IDE, not in jupyter
Hope these elements help