Including HTML blocks for ipynb format #2076
Unanswered
linogaliana
asked this question in
Q&A
Replies: 1 comment 6 replies
-
|
Did you try to include your HTML code in an HTML code block? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
-
Hi !
Context
I am trying to generate some content in
ipynboutput to generate some callout boxes in Jupyter Notebook (a provisory version before #1167 solves the issue). In Jupyter, you can visualise boxes usingdivwithalertclass. For instance, the following code:yields :
My questions goes beyond the issue of creating callout boxes (since #1167 that is in Future milestone is supposed to solve that) but is more related to the presence of html blocks when
qmd->ipynb.Question 1
In my
.qmdif I put the below text:when using
quarto render index.qmd --to ipynb, the blocks<div class="alert alert-danger" role="alert">and</div>are not included in myindex.ipynb. Thus, I just end up with an unformatted markdown cell with the text I wanted in the box.Is the disappearance of
<div ...>and</div>an expected behavior ?Question 2
I then tried to change
divbypjust to see what happens. It yields the same red box in atest.ipynbdraft in a local Jupyter session. However, if I put the text in.qmdfile:this will generate three different blocks in my
ipynb:<p class="alert alert-danger" role="alert">in a raw cell</p>in a raw cellIf everything were in the same cell, the formatting would have worked.
I see that each time
quartoencounters a<p>and</p>, it creates a separated raw cell (instead of a markdown cell). Once again, is it an expected behavior ?Other approach tried
I tried to use the Rmd's custom block functionality:
::: {#mybox .alert .alert-danger} Il faut faire attention au `display` et aux commandes qui révèlent des données (`head`, `tail`, etc.) dans un notebook ou un markdown qui exploite des données confidentielles lorsqu'on utilise `git`. En effet, on peut se retrouver à partager des données, involontairement, dans l'historique `git`. Avec un `R markdown`, il suffit d'ajouter les sorties au fichier `gitignore` (par exemple avec une balise de type `*.html`). Avec un notebook `jupyter`, la démarche est plus compliquée car les fichiers `.ipynb` intègrent dans le même document, texte, sorties et mise en forme. Techniquement, il est possible d'appliquer des filtres avec `git` (voir [ici](http://timstaley.co.uk/posts/making-git-and-jupyter-notebooks-play-nice/)) mais c'est une démarche très complexe :::hoping to end-up with that block in my
ipynb:As in question 1,
<div ...>and</div>are not present.This pandoc's fenced div block is not implemented in
quarto(foripynboutput at least) ?Beta Was this translation helpful? Give feedback.
All reactions